0

帖子之后修复以下错误:

>> 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
4

4 回答 4

4

我在做ssh -T git@github.com。我不得不这样做ssh -T git@github.company's-github-account-name.com。现在一切就绪。

于 2012-07-10T20:56:42.193 回答
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 服务器之间存在某种延迟。您可能应该尝试您引用的页面底部的“联系人类”链接。

于 2012-07-09T18:12:55.020 回答
0

可以使用以下命令对这个 GIT 问题“Git – Permission denied (publickey)”进行广泛的故障排除:

ssh -vT git@github.com
  1. 导航到主目录中的 .ssh 目录

    cd ~/.ssh
    
  2. 生成公钥/私钥 rsa 密钥对

    ssh-keygen
    
  3. 使用以下命令将 SSH 密钥复制到剪贴板

    cat id_rsa.pub | clip
    
  4. 导航到https://github.com/中的 GIT 存储库

  5. 转到帐户设置 -> SSH 密钥

  6. 单击添加 SSH 密钥并存储密钥

于 2013-04-09T02:58:22.873 回答
0

我同意@Ava 发布的答案。使用ssh -T git@github."company's_github_account".com它对我有用。很多时候,我们没有意识到对于看似复杂的问题存在简单的解决方案。

于 2014-02-28T18:07:32.410 回答