通过SSH访问github错误 – 可能与新的公钥有关

我有点失落,我得到的错误,我敢肯定有人可能会马上知道什么是错的。 我想我们必须像一个月前一样向github添加新的公钥,所以我怀疑它是与此有关的。

如果我ssh进入服务器,并做(我有正确的public_key,因为我可以ssh):

deploy@test:~/.ssh$ ssh -T [email protected] Permission denied (publickey). deploy@test:~/.ssh$ 

如果我做:

 deploy@test:~/.ssh$ ssh -vT [email protected] 

我明白了

 .... debug1: sending SSH2_MSG_KEX_ECDH_INIT debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: Server host key: RSA xxxxxx debug1: Host 'github.com' is known and matches the RSA host key. debug1: Found key in /home/deploy/.ssh/known_hosts:1 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: Roaming not allowed by server debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Offering RSA public key: /home/deploy/.ssh/id_rsa debug1: Authentications that can continue: publickey debug1: Trying private key: /home/deploy/.ssh/id_dsa debug1: Trying private key: /home/deploy/.ssh/id_ecdsa debug1: No more authentication methods to try. Permission denied (publickey). deploy@test:~$ ls 

我是否需要删除我的authorized_keys或known_hosts?

谢谢

编辑1

我正在使用这里提到的agent_forwarding: https ://help.github.com/articles/deploying-with-capistrano我认为应该避免在服务器上有密钥的需要。

编辑2

我的本地.ssh / config文件

 ServerAliveInterval 120 ServerAliveCountMax 3 Host staging.domain.com ForwardAgent yes Host github.com IdentityFile ~/.ssh/id_rsa.github 

只要检查github存储库上的设置,如果有任何这些键仍然存在:

/home/deploy/.ssh/id_dsa

家用/部署/的.ssh / id_ecdsa

有两种可能性:

  1. 要么重新生成服务器上的密钥。

或者2.有人更改了Github上的设置。