git拉取代码报错,代理拒绝操作:sign_and_send_pubkey: signing failed: agent refused operation

将ubuntu16.04更新到18.04后,使用git拉取服务器代码,遇到“sign_and_send_pubkey: signing failed: agent refused operation”代理拒绝的报错:

... A new repo command (  2.3) is available.
... You should upgrade soon:

    cp /android13/work_dir/.repo/repo/repo /usr/bin/repo

sign_and_send_pubkey: signing failed: agent refused operation
[email protected]: Permission denied (publickey).
sign_and_send_pubkey: signing failed: agent refused operation
[email protected]: Permission denied (publickey).
fatal: 无法读取远程仓库。

请确认您有正确的访问权限并且仓库存在。

首先检查了代码服务器上添加的公钥和本地机器中文件“~/.ssh/id_rsa.pub”一致。

最后发现是本地.ssh公私钥文件权限问题导致的。

解决此问题的方法是确保您对~/.ssh目录下的id_rsa和id_rsa.pub文件有正确的权限:

更改文件的权限,使用命令:

sudo chmod 600 ~/.ssh/id_rsa
sudo chmod 644 ~/.ssh/id_rsa.pub

这就解决了我的git代码更新问题

猜你喜欢

转载自blog.csdn.net/u013301596/article/details/131087424
今日推荐