mbp配置github,在網上找了幾個都是複製來複制去,不行,自己還是去看官方文檔。
1、安裝客戶端(https://mac.github.com/),這裏跟其他系統的區別是安裝了沒有.ssh文件。所以要生成這個文件。輸入命令
ssh-keygen -t rsa -C "[email protected]"
然後生成了.ssh文件。
2、添加新key到ssh-agent
# start the ssh-agent in the background eval "$(ssh-agent -s)" # Agent pid 59566 ssh-add ~/.ssh/id_rsa
3、添加sshkey到你的賬戶
pbcopy < ~/.ssh/id_rsa.pub(將你的公鑰複製到剪貼板,然後在網站上添加到sshkey)
4、測試
輸入:ssh -T [email protected]
你會看見警告:
The authenticity of host 'github.com (207.97.227.239)' can't be established. # RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48. # Are you sure you want to continue connecting (yes/no)?然後輸入yes,看見
Hi username! You've successfully authenticated, but GitHub does not # provide shell access.,這樣就成功了!官方鏈接:https://help.github.com/articles/generating-ssh-keys/