【发布时间】:2020-06-24 23:00:01
【问题描述】:
我试图在 git commit 之后推送我的项目,但我遇到了一个错误:
git push
sign_and_send_pubkey: signing failed for RSA "/home/acer/.ssh/id_rsa" from agent: agent refused operation
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.
是连线的,因为我之前在同一个项目上推送了其他更改,而这个错误只出现在这个项目中!!!
【问题讨论】:
-
谷歌搜索“权限被拒绝(公钥)”在help.github.com/en/github/authenticating-to-github/… 给出了第一个命中。我建议按照那里的说明解决问题。
-
你能检查你的 id_rsa 是一个有效的私钥吗?例如你可以试试
openssl rsa -in id_rsa看看openssl 是否会接受它。生成新密钥并将新公钥上传到 github 可能是最简单的。 -
您使用的是什么操作系统?您可以编辑您的问题以在代码块中包含
env | grep '^SSH'的输出吗? -
确保您的 ssh 密钥具有受限权限 (
chmod 600 keyname)。