SourceTree正确配置SSH key之后仍然提示fatal: Could not read from remote repository.

如题,按照网上的配置SSHkey (不知道的可以百度搜索MAC Git SSH 配置)后,使用sourcetree 仍然出现如下问题:

[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.

[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.

[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.

[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.

最后总结一下,常规配置完成后一定要执行 ssh-add id_rsa,然后重新再试一下,妥了,下面附上完整配置SSH key流程

完整步骤

$ cd  ~/.ssh

$ ssh-keygen -t rsa -C 你的邮箱         #此时会让你输入文件名,私钥文件访问密码,ssh目录下会生成两个文件,可使用ls命令查看

$ cat id_rsa.pub                                        #查看公钥,复制到GitHub添加ssh key

$ ssh -T [email protected]                       #验证

Hi XXXX! You've successfully authenticated, but GitHub does not provide shell access.

$ ssh-add id_rsa

你可能感兴趣的:(SourceTree正确配置SSH key之后仍然提示fatal: Could not read from remote repository.)