为什么我在使用git时出现ssh_exchange_identification: Connection closed by remote host错误?

3

从终端克隆一个仓库:

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 克隆存储库,但在此之后,我无法执行其他操作(检出/推送...)。

有什么建议可能会导致这种情况或如何修复它?


1
你可以尝试从这个网站上的步骤,比如使用ssh -v来获得更详细的输出。附注:你可以在问题中更新详细输出内容。 - YesThatIsMyName
1
谢谢您的建议!已经这样做了。 - Durdu
1个回答

1
在我的情况下,这是由于缺少VPN连接造成的。
此外,@YesThatIsMyName评论道:
“您可以尝试this网站中的步骤,例如使用ssh -v以获得更详细的输出。附注:您可以使用详细输出更新您的问题。”

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接