1. 程式人生 > >git bash 關聯給GitHub如何使用公鑰登入問題

git bash 關聯給GitHub如何使用公鑰登入問題

 
問題:
          使用git bash 關聯gitHub上的庫產生問題(使用ssh 公鑰 登入原理來實現)文末有原理講解。 
          關鍵字:ssh授權登入方式
補充:這個問題解釋了,對於初學者為什麼Git登入GitHub不需要密碼,
                                        答案:使用ssh 進行身份驗證登入的方式(不是將公鑰發給了GitHub了,從三體上將兩者已經產生了關聯,笑,皮一下)

問題描述
              在使用命令:git push -u origin master  (上傳同步分支到GitHub上)出現如下問題

The authenticity of host 'github.com (13.229.188.59)' 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,13.229.188.59' (RSA) to the list of known hosts.
Permission denied (publickey).  //公鑰授權否認
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

問題描述:沒有授權公鑰的使用

解決方式: 

授權登入:生成祕鑰對,新增公鑰到GitHub伺服器中,再次登入即可

步驟一:  ssh  -T [email protected]  去測試一下是否連線成功


測試是否連線成功
步驟二:使用 ssh-keygen  -t rsa -C "郵箱@qq.com" (郵箱寫自己GitHub註冊郵箱)

步驟三:公鑰,檢視將其新增到GitHub上

檢視完後,貼上複製到GitHub上,具體位置-setting/ssh and GPG keys 


 

後補:

應用的原理:ssh 為什麼可以這樣用呢?
這裡新增示意圖:

ssh 使用公鑰登入