進行本教程前需要在GitHub上註冊賬號,一定要記住郵箱、用戶名和密碼呀!
一、下載安裝Git
Git 各平臺安裝包下載地址爲:http://git-scm.com/downloads
下載Windows版本,安裝到電腦即可。
安裝後如何啓動:在開始菜單裏輸入Git,找到Git Bash,打開彈出 Git 命令窗口,就可以進行Git操作了。
二、Windows下GitHub的SSH key配置
1.打開 Git Bash,輸入如下命令,回車:
ssh-keygen -t rsa -C "[email protected]"
2.將SSH私鑰添加到 ssh-agent
(1)在後臺啓動 ssh-agent
eval $(ssh-agent -s)
(2)將SSH公鑰添加到GitHub賬戶
ssh-add /c/Users/Lcc/.ssh/id_rsa
(3)將SSH公鑰添加到GitHub賬戶
- 複製SSH公鑰:/C/Users/Lcc/.ssh/id_rsa.pub這個文件的完整內容
- 登陸GitHub賬號,找到Settings
- 找到左側欄SSH and GPG keys後點擊Add
- 起個名字,把之前複製的內容粘貼進來
- 測試:打開 Git Bash 輸入:
ssh -T [email protected]
然後輸入yes,回車。 如果提示中顯示了你的用戶名,說明SSH key已經配置成功。
如果提示的是“ access denied”, 你可以查閱 read these instructions for diagnosing the issue的相關資料.