【问题标题】:Permission denied (publickey) error when using Git?使用 Git 时权限被拒绝(公钥)错误?
【发布时间】: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)。

标签: git github git-push


【解决方案1】:

感谢$ ssh-add ~/.ssh/id_rsa解决

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-03-18
    • 1970-01-01
    • 2012-07-09
    • 1970-01-01
    • 2020-01-04
    • 2013-11-08
    • 2020-12-30
    相关资源
    最近更新 更多