跳至主要内容

错误:代理承认签名失败

在少数情况下,通过 SSH 在 Linux 上连接 GitHub 会出现错误 "Agent admitted failure to sign using the key"。请按照以下步骤解决此问题。

在 Linux 计算机上尝试 SSH 连接 GitHub.com 时,您可能会在终端看到以下信息

$ ssh -vT git@github.com
> ...
> Agent admitted failure to sign using the key.
> debug1: No more authentication methods to try.
> Permission denied (publickey).

欲了解更多细节,请参阅 Canonical Launchpad 上的 此问题报告

解决方案

您可以通过使用 ssh-add 将密钥加载到 SSH 代理中来修复此错误

# start the ssh-agent in the background
$ eval "$(ssh-agent -s)"
> Agent pid 59566
$ ssh-add
> Enter passphrase for /home/YOU/.ssh/id_rsa: [tippy tap]
> Identity added: /home/YOU/.ssh/id_rsa (/home/YOU/.ssh/id_rsa)

如果您的密钥没有默认文件名(/.ssh/id_rsa),则需要将该路径传递给 ssh-add

# start the ssh-agent in the background
$ eval "$(ssh-agent -s)"
> Agent pid 59566
$ ssh-add ~/.ssh/my_other_key
> Enter passphrase for /home/YOU/.ssh/my_other_key: [tappity tap tap]
> Identity added: /home/YOU/.ssh/my_other_key (/home/YOU/.ssh/my_other_key)
© . This site is unofficial and not affiliated with GitHub, Inc.