git push時提示The authenticity of host 'github.com (52.74.223.119)' can't be established.


問題現象:

github上創建了一個遠程倉庫,將我的代碼推送到遠程倉庫git push -u origin master時,出現下面報錯

 

The authenticity of host 'github.com (52.74.223.119)' can't be established.

RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'github.com,52.74.223.119' (RSA) to the list of known hosts.

git@github.com: Permission denied (publickey).

fatal: Could not read from remote repository.

問題原因:Github與ssh連接需要密鑰

解決方法:

1.本地mac 公鑰路徑取密鑰:cd ~/.ssh  (id_rsa.pub

 

2. 登錄自己的github進入項目的存儲庫----進入setting----部署秘鑰(Deploy keys)

3.配置ssh key的時候勾選下面的Allow write access,在settings的deploy key欄目才有讀寫權限

4.配置完成之后再去項目中操作git即可

 

 

解決結果:

 

 

git push -u origin master

 

Enumerating objects: 3, done.

 

Counting objects: 100% (3/3), done.

 

Writing objects: 100% (3/3), 218 bytes | 109.00 KiB/s, done.

 

Total 3 (delta 0), reused 0 (delta 0)

 

To git+ssh://github.com/illusion1010/Hog.git

 

 * [new branch]      master -> master

 

Branch 'master' set up to track remote branch 'master' from 'origin'.

 


免責聲明!

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



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