git clone时报错Permission denied (publickey,password)

在使用git clone xxxx时,报错,如图

git clone时报错Permission denied (publickey,password)_第1张图片

1、上网查资料,说可能是SSH Key不存在

使用命令ls ~/.ssh/,可以看到,SSH key是存在的,所以这种情况排除

在这里插入图片描述

2、按github官网:

1)、Ensure the ssh-agent is running:

#start the ssh-agent in the background
$ eval $(ssh-agent -s)
> Agent pid 59566

2)、Add your SSH private key to the ssh-agent

$ ssh-add ~/.ssh/id_rsa

3)、添加ssh key到github

git clone时报错Permission denied (publickey,password)_第2张图片

复制
git clone时报错Permission denied (publickey,password)_第3张图片

文件中的内容,粘贴保存。

4)、测试连接

ssh -vT [email protected] ,显示成功。

3、重新git clone xxx,成功执行

总结: 重新添加了ssh key就成功了。

你可能感兴趣的:(git)