logo_login.png
SSH Keys是可以讓你的電腦和git倉庫建立連接的鑰匙
在建立git是需要配置SSH Keys
1.首先如果沒有安裝git的話需要去git官網(wǎng)進行下載
2.git安裝完畢之后進行相關(guān)配置
2.1配置用戶名:
git config --global user.name "xxx"
2.2配置email
git config --global user.email "xxx.com"
3.配置完以后按照以下命令來生成SSH Keys
ssh-keygen -t rsa -C "xxx.com"
4.查看你的publick key
cat ~/.ssh/id_rsa.pub
5.把在上邊終端輸入之后顯示的SSH Keys添加到對于git網(wǎng)站的SSH Keys中
github驗證 ssh -T git@github.com
6.克隆git倉庫的代碼
git clone xxxx
6.1創(chuàng)建分支
git check out -b $feature-name
6.2獲取遠(yuǎn)程分支master并merge到當(dāng)前分支
git pull origin xx
6.3添加當(dāng)前子目錄下所有變更過的文件至index
git add .
6.4提交變更
git commit -m "更新代碼"
6.5再次獲取分支
git pull origin xx
6.6把當(dāng)前分支push到遠(yuǎn)程xx分支
git push origin xx
6.7將當(dāng)前分支push到遠(yuǎn)程master分支
git pull origin master
6.8上傳代碼到遠(yuǎn)程倉庫
git push -u origin master
git在pull 或者 push 的時候出現(xiàn)一個編輯界面
需要輸入一些解釋的話
1旗们、按鍵盤字母 i 進入insert模式
2禀晓、修改上邊那行黃色合并信息,也可以不修改
3恋博、按鍵盤左上角 “esc”
4瘫絮、 輸入 “:wq”,注意是 冒號+wq,按回車即可