$ ssh -T git@github.com
测试连接成功,但是clone时出现
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 -Tv git@github.com
测试连接github发现他用的是默认的id-rsa,而我添加的key是自己重新命名的xx-rsa
出现这种情况我们可以在.ssh添加一个config文件写入
Host github.com
HostName github.com
User 你的用户名
IdentityFile 你的rsa秘钥地址
IdentitiesOnly yes
此时就可以成功clone了
网友评论