git 的簡單使用

2021-10-07 08:43:59 字數 1999 閱讀 7271

git 的簡單使用流程

推送到github中

sudo add-apt-repository ppa:git-core/ppa 

sudo apt update

sudo apt install git

git -

-version

#建立新資料夾

mkdir learn_git

cd lern_git

#檢視資料夾中包含的檔案有哪些

ls -al

# 初始化倉庫

git init

#檢視資料夾中包含的檔案有哪些, 多增加了乙個 .git檔案

ls -al

#設定使用者名稱 和 郵箱

git config -

-global user.name "yl"

git config -

-global user.email " [email protected]"

#檢視設定

clear #清空

touch learn_git.html #新建乙個html檔案

git status #檢視狀態

git add learn_git.html #跟蹤learn_git.html檔案

git commit -m "create learn_git.html"

#提交到倉庫並注釋

gedit learn_git.html #編輯

git status #檢視狀態

git add .

#跟蹤所有檔案

git commit -m "web1.0"

#提交到倉庫並注釋

git log #檢視修改版本記錄

learn git<

/title>

<

/head>

"color:orange"

>hello git<

/h1>

<

/body>

<

/html>

# 其中為遠端的倉庫命名為 origin

git remote add origin [email protected]:chiyandetaotie/learn_git.git

# 檢視遠端倉庫

git remote

ssh-keygen -t rsa -c "[email protected]"

cd /home/yl/

.ssh

ls

#id_rsa(私鑰) id_rsa.pub(公鑰)

cat id_rsa.pub # 獲取公鑰

#檢視遠端倉庫和本地是否連線上

ssh -t [email protected]

git新增公鑰後若報錯,如下:

sign_and_send_pubkey: signing failed: agent refused operation的解決辦法
可輸入命令列如下:

eval

"$(ssh-agent -s)"

ssh-add

git push -u origin master

git的簡單使用

公司用svn來管理進行版本管理,使用不是很習慣。偶然在網路上看到git這個工具,覺得很不錯,正好可以用來對自己的 進行管理,以後就不需要再打包乙個乙個備份了。平台是 centos5 git version git version 1.7.8.git 初始化乙個git倉庫 git init 提交使用者...

git的簡單使用

git 新建乙個專案,cd 開啟這個資料夾第一層目錄就好了,git branch一下檢視分支 git branch develop建立乙個分支 git branch 檢視分支,現在你就有兩個了 git checkout develop切換到開發分支 現在你發現develop是綠色的,說明你在當前分支...

git 的簡單使用

1.git init 2.git config global user.email huazai com 3.git config global user.name huazai 4.git add 5.git commit m 說明這次有哪些改動 6.git log 7.git help 8.gi...