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

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

git@github.com: Permission denied (publickey).

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

and the repository exists.

git@github.com: Permission denied (publickey).

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

and the repository exists.

git@github.com: Permission denied (publickey).

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

and the repository exists.

git@github.com: 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 git@github.com                       #验证

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

$ ssh-add id_rsa

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容