MAC 配置ssh允許SourceTree通過秘鑰訪問遠程倉庫


按如下命令來生成 sshkey:

ssh-keygen -t rsa -C "xxxxx@xxxxx.com"

按照提示完成三次回車(設置密碼為空),即可生成 ssh key;

添加后,在終端(Terminal)中輸入:

ssh -T git@gitee.com

若返回 :

Hi XXX! You've successfully authenticated, but Gitee.com does not provide shell access.

則證明添加成功。

將公鑰添加到git服務器;(例如:github; gitee; …)
划重點: 執行ssh-add -K ~/.ssh/id_rsa 將sshkey添加到鑰匙串;

Host ‘git服務器的域名’
HostName ‘git服務器的域名’
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa(私鑰的路徑)

如coding

Host conding.com
HostName e.coding.net
IdentityFile ~/.ssh/id_rsa_coding

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM