发布this帖后修复以下错误:
>> ssh -vT git@github.com
OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /Users/user/.ssh/config
debug1: Applying options for *
debug1: Reading configuration data /etc/ssh_config
debug1: Applying options for *
debug1: Connecting to github.com [207.97.227.239] port 22.
debug1: Connection established.
debug1: identity file /Users/user/.ssh/id_rsa type 1
debug1: identity file /Users/user/.ssh/id_rsa-cert type -1
debug1: identity file /Users/user/.ssh/id_dsa type -1
debug1: identity file /Users/user/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5github2
debug1: match: OpenSSH_5.1p1 Debian-5github2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /Users/user/.ssh/known_hosts:10
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: /Users/user/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/user/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).
通过帖子确保我有一个密钥,SSH正在使用它。我甚至已经验证公钥是附加到我的github帐户。不确定最后3行中的-1?看到所有相关的帖子但没有帮助。
debug1: identity file /Users/user/.ssh/id_rsa type 1
debug1: identity file /Users/user/.ssh/id_rsa-cert type -1
debug1: identity file /Users/user/.ssh/id_dsa type -1
debug1: identity file /Users/user/.ssh/id_dsa-cert type -1
答案 0 :(得分:4)
我在做ssh -T git@github.com
。我不得不做ssh -T git@github.company's-github-account-name.com
。现在全部设定。
答案 1 :(得分:1)
最可能的问题是,公钥实际上并没有正确附加到您的github帐户。你能否确认
的输出ssh-keygen -y -f /Users/user/.ssh/id_rsa
与你在Github中的内容完全相同,如果你这样做
ssh-keygen -y -f /Users/user/.ssh/id_rsa > tmp
ssh-keygen -l -f tmp
..显示的指纹与https://github.com/settings/ssh显示的指纹完全匹配?
修改:您确认了。看起来你已经做好了一切。我想不出更多可能出错的地方。我想你可能会得到错误的远程主机(IP是正确的,但是恶意的人或行为不端的企业防火墙仍然可能将数据包发送到错误的位置)。您可以通过查看已存储在known_hosts文件中的指纹来检查这一点:
ssh-keygen -F github.com > tmp
ssh-keygen -l -f tmp
输出应以:
开头2048 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
如果确实如此,那么我认为它毕竟可能是github方面的一个问题。也许他们在接收您的公钥并将其传播到主ssh服务器之间存在某种延迟。您可能应该尝试在您引用的页面底部的“联系人”链接。
答案 2 :(得分:0)
此GIT问题的广泛故障排除“Git - Permission denied(publickey)”可以使用以下命令完成:
ssh -vT git@github.com
导航到主目录中的.ssh目录
cd ~/.ssh
生成公共/私有rsa密钥对
ssh-keygen
使用以下命令将SSH密钥复制到剪贴板
cat id_rsa.pub | clip
转到帐户设置 - &gt; SSH密钥
点击添加SSH密钥并存储密钥
答案 3 :(得分:0)
我同意@Ava发布的答案。使用ssh -T git@github."company's_github_account".com
它对我有用。很多时候,我们没有意识到对于看似复杂的问题存在简单的修复。