problem
Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
分析
这种问题一般都是密钥设置不正确造成的,首先检查有没有在Git的网站上添加你本机的SSH key。
注意换了电脑是要重新添加的,每台都不一样。在用户主目录下,看看有没有.ssh目录,
如果有,再看看这个目录下有没有id_rsa和id_rsa.pub这两个文件,如果已经有了,可直接跳到下一步。
如果没有,打开Shell(Windows下打开Git Bash),创建SSH Key.
创建SSH Key:
Add SSH Public Key How to Generate an SSH Key 1. From the Terminal or Git Bash, run ssh-keygen 2. Confirm the default path .ssh/id_rsa 3. Enter a passphrase (recommended) or leave it blank. Remember this passphrase, as you will need it to unlock the key whenever you use it. 4. Open ~/.ssh/id_rsa.pub and copy & paste the contents into the box below, then click on "Add". Note that id_rsa.pub is your public key and can be shared, while id_rsa is your private key and should be kept secret.
验证是否添加成功
$ ssh usrname@usremail
参考
1. git@github.com: Permission denied (publickey). fatal: Could not read from remote repository的问题解决;
2. fatal: Could not read from remote repository.的解决办法;
完