首页 > 解决方案 > 为什么我在 git get ssh_exchange_identification: Connection closed by remote host?

问题描述

从终端克隆一个 repo:

git clone git@github.foohost.com:barrepo.git
Cloning into 'foorepo'...
ssh_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我已经按照生成和添加 SSH 密钥的步骤进行操作,但是当 我测试我的 SSH 连接时,我得到了相同的结果:

ssh -T git@github.foohost.com:
ssh_exchange_identification: Connection closed by remote host

使用详细

ssh -v git@github.foohost.com
OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/Fred/.ssh/config
debug1: /Users/Fred/.ssh/config line 18: Applying options for *
debug1: /Users/Fred/.ssh/config line 27: Applying options for github.foohost.com
debug1: /Users/Fred/.ssh/config line 41: Applying options for *.foohost.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Executing proxy command: exec ssh -q b.snc1 nc github 22
debug1: identity file /Users/Fred/.ssh/baz_rsa type 0
debug1: identity file /Users/Fred/.ssh/baz_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
ssh_exchange_identification: Connection closed by remote host

我可以使用 https 克隆存储库,但之后我无法执行其他操作(结帐/推送...)。

有什么建议可能导致此问题或如何解决?

标签: gitgithubssh

解决方案


就我而言,这是由于缺少 VPN 连接。

此外,@YesThatIsMyName 评论道:

您可以尝试网站上的步骤,例如 ssh -v 以获得更详细的输出。PS您可以使用详细输出更新您的问题。——</p>


推荐阅读