Git遠程克隆倉庫出現Permission denied (publickey)


$ git clone git@github.com:DavidWanderer/test1.git
Cloning into 'test1'...
Warning: Permanently added the RSA host key for IP address '192.30.253.113' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

MAC終端克隆倉庫出現以上錯誤。原因是沒有將自己電腦的SSH key添加到GitHub上。解決辦法:

1.生成SSH Key

$ ssh-keygen -t rsa -C "XXXX.com"

2.找到生成Key值的目錄,前往.ssh目錄,這個目錄下會生成三個文件:id_rsa(私鑰),id_rsa.pub(公鑰),known_hosts。

3.登錄GitHub,然后選擇Personal Settings->SSH and GPG keys->New SSH Key

title隨便填一個,然后把第二步產生的id_rsa.pub中的文本內容復制到key的文本框中,然后點擊Add SSH key,然后在MAC終端重新克隆,就可以正常克隆了。

 

參考鏈接:

遠程倉庫

 

 

 


免責聲明!

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



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