[email protected]: Permission denied (publickey). fatal: Could not read from remote repository的问题解决

问题描述[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Failed during: git fetch origin master:refs/remotes/origin/master --tags --force
问题分析:
由于你的github SSH秘钥设置不对导致的。
解决方法

  1. 在你的项目根目录下,右键git bash here
  2. 根据你的邮箱生成公钥和私钥
    命令:ssh-****** -t rsa -C [email protected]
    然后一路回车,使用默认命令即可[email protected]: Permission denied (publickey). fatal: Could not read from remote repository的问题解决
    如上图代表生成成功!如果一切顺利的话,可以在用户主目录里找到.ssh目录,里面有id_rsa和id_rsa.pub两个文件,这两个就是SSH Key的秘钥对,id_rsa是私钥,不能泄露出去,id_rsa.pub是公钥,可以放心地告诉任何人。

[email protected]: Permission denied (publickey). fatal: Could not read from remote repository的问题解决上图就是生成的公钥、**

  1. 登陆GitHub,打开“Account settings”,“SSH Keys”页面:
    然后,点“Add SSH Key”,填上任意Title,在Key文本框里粘贴id_rsa.pub文件的内容:[email protected]: Permission denied (publickey). fatal: Could not read from remote repository的问题解决
    [email protected]: Permission denied (publickey). fatal: Could not read from remote repository的问题解决

点击[email protected]: Permission denied (publickey). fatal: Could not read from remote repository的问题解决就可以看到生成的**了。再次回到项目push你的代码就可以了,大功告成!!