红联Linux门户
Linux帮助

Rails:Ubuntu下连接Git提示Permission denied的解决方法

发布时间:2017-02-03 09:58:09来源:blog.csdn.net/mydo作者:大熊猫侯佩
在第一次安装全新Ubuntu系统后,执行git clone命令出错:
正克隆到 'riskmgr'...
sign_and_send_pubkey: signing failed: agent refused operation
Permission denied (publickey,keyboard-interactive).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
 
首先确保你在.ssh目录中生成了keys,然后你需要将pub_key添加到git公钥库中。
 
接下来你可以用ssh先测试一下连接:
ssh -T git@code.csdn.net
sign_and_send_pubkey: signing failed: agent refused operation
 
可以看到连接被拒绝了,接下来确保你的ssh-agent在运行:
eval "$(ssh-agent -s)"
Agent pid 59566
 
然后手动加载你的key:
ssh-add
Enter passphrase for /home/you/.ssh/id_rsa: [tippy tap]
Identity added: /home/you/.ssh/id_rsa (/home/you/.ssh/id_rsa)
 
注意上面第一步,如果你在生成keys时设置了passphrase,你需要验证;如果没有,你只需简单回车即可。
 
然后我们再测试一下连接:
ssh -T git@code.csdn.net
Invalid GIT command
 
以上表示成功,如果不放心,你可以用 -Tv 来看详细信息。
 
本文永久更新地址:http://www.linuxdiyf.com/linux/28115.html