【问题标题】:Why my SSH hang on there while connecting to github?为什么我的 SSH 在连接到 github 时挂在那里?
【发布时间】:2012-07-27 19:40:43
【问题描述】:

这是我今天尝试做十次但没有成功的:

  • 使用 ssh-keygen 创建密钥。
  • 使用 Gedit 或 Notepad++ 打开 ~/.ssh/id_rsa.pub 并复制内容。
  • 转到 github.com 上的帐户设置
  • 转到 SSH 密钥
  • 单击“添加密钥”按钮。
  • 给键一个标题
  • 将钥匙粘贴到钥匙盒中。
  • 保存密钥(输入我的github密码进行验证)。

然后,我在 cygwin 中运行“$ ssh -vT git@github.com”,但它总是挂在那里。这是输出:

$ ssh -vT git@github.com
OpenSSH_6.0p1, OpenSSL 1.0.1c 10 May 2012
debug1: Reading configuration data /home/eason.wu/.ssh/config
debug1: /home/eason.wu/.ssh/config line 1: Applying options for github.com
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to github.com [207.97.227.239] port 22.
debug1: Connection established.
debug1: identity file /home/eason.wu/.ssh/id_rsa type 1
debug1: identity file /home/eason.wu/.ssh/id_rsa-cert type -1

有没有人遇到过这个问题,不胜感激

【问题讨论】:

    标签: ssh github cygwin


    【解决方案1】:

    确保您确实将公钥复制为 一个 行,因为来自编辑器的副本有时可以将该密钥的内容缓冲为几行。

    如果您仍有问题,请通过“Unable to Git-push master to Github”查看其他 SSH 调试提示。
    ssh -vvvT git@github.com 可以显示更多的调试信息。


    OP Eason Wucmets:

    我找到了这个问题的真正原因,是我的网络造成的。
    我公司禁止了一些网站,我想这也会影响到GitHub服务。
    我打开VPN连接后,用ssh -vvvT git@github.com重新测试,成功通过

    【讨论】:

    • 是的,我确实在一行中复制了它。我还创建了一个像提到的提示一样的配置文件,它仍然不起作用。在使用选项-vvvT 后,它会抛出一条新消息Could not load "/home/eason.wu/.ssh/id_rsa" as a RSA1 public key,不确定我的密钥是否不正确?但是我在help.github.com/articles/generating-ssh-keys 之后生成了密钥。这很奇怪。不管怎样,谢谢你的回复。
    • @EasonWu 检查你.ssh 保护:见stackoverflow.com/questions/3712443/…
    • 我为 .ssh 下的文件添加了对登录用户的完全控制,但仍然无法连接到服务器。我下载了github提供的工具,通过SSH方式运行良好,应该是有些步骤我做错了。谢谢你的建议!!!
    • 我找到了这个问题的真正原因,是我的网络造成的。有些网站被我公司禁止了,我认为它也会影响 github 服务。我打开VPN连接后,用ssh -vvvT git@github.com重新测试,成功通过。
    • @EasonWu 非常棒。为了提高知名度,我已将您的结论包含在答案中。
    【解决方案2】:

    对于最近来这里寻找解决方案的任何人,这也发生在我身上,但是在调试中(根据上述说明),与 GitHub 的连接从未建立。

    我的输出看起来像:

    OpenSSH_7.9p1 Ubuntu-10, OpenSSL 1.1.1b  26 Feb 2019
    debug1: Reading configuration data /home/preston/.ssh/config
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: /etc/ssh/ssh_config line 19: Applying options for *
    debug2: resolving "github.com" port 22
    debug2: ssh_connect_direct
    debug1: Connecting to github.com [2607:7700:0:1a:0:1:c01e:ff70] port 22.
    

    我注意到最后一行中的 IPv6 地址并认为这可能是问题所在。所以我参考了一篇关于在全局 ssh 设置中将其更改为使用 IPv4 地址的文章。

    更改为 IPv4 成功。

    来源:https://stackoverflow.com/a/35113901/3818056

    【讨论】:

      【解决方案3】:

      对我来说,问题是我连接的路由器使用的是 WPA,而不是 WPA2/3。一旦我更改为没有此问题的网络,我的 repo 立即被 ssh 克隆。

      【讨论】:

        猜你喜欢
        • 2012-04-15
        • 1970-01-01
        • 2014-01-04
        • 1970-01-01
        • 2020-12-28
        • 1970-01-01
        • 2014-04-20
        • 2020-12-02
        • 2017-06-02
        相关资源
        最近更新 更多