git pull 出錯 fatal: Could not read from remote repository.Please make sure you have the correct access rights.and the repository exists.


Warning: Permanently added the RSA host key for IP address '192.30.252.131' 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 key


解決方法如下

在終端輸入。

 ssh-keygen -t rsa -C "forwhat.cn"//注意。forwhat.cn為用戶名

如果執行成功。返回

Generating public/private rsa key pair.
Enter file in which to save the key (/home/forwhat.cn/.ssh/id_rsa):
在這里就是設置存儲地址了.反正我是直接按的回車

然后還會返回

Enter passphrase (empty for no passphrase):

再次直接回車。
Enter same passphrase again:

再次回車。

Your identification has been saved in /home/forwhat.cn/.ssh/id_rsa.
Your public key has been saved in /home/forwhat.cn/.ssh/id_rsa.pub.
The key fingerprint is:
這里有一串數。我把他屏蔽了。
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
|                 |
|    o            |
|   + .  S        |
|  . = .  o       |
|   o + +o.o      |
|E o . o.=+.      |
|.+   ==+ooo.     |
+-----------------+
這樣SSH key就生成了。直接cat一下就好了。

000000:~/a$ cat /home/forwhat.cn/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQ(我屏蔽了)

把顯示出來的直接添加到github賬戶設置里邊的SSH keys
。add.

回來在git pull

就開始遠程拷貝代碼了

 

 

轉載地址:www.forwhat.cn


免責聲明!

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



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