ssh_exchange_identification:Git bash下的远程主机关闭了连接 [英] ssh_exchange_identification: Connection closed by remote host under Git bash

查看:354
本文介绍了ssh_exchange_identification:Git bash下的远程主机关闭了连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在win7工作,并使用sshd设置了git服务器. 我git --bare init myapp.git,并在 Cywgin 中正确克隆了ssh://git@localhost/home/git/myapp.git.但是我再次需要配置 Cygwin 的git,我想在 Git Bash 中进行git clone.我运行git clone ssh://git@localhost/home/git/myapp.git并收到以下消息

I work at win7 and set up git server with sshd. I git --bare init myapp.git, and clone ssh://git@localhost/home/git/myapp.git in Cywgin correctly. But I need config git of Cygwin again, I want to git clone in Git Bash. I run git clone ssh://git@localhost/home/git/myapp.git and get following message

ssh_exchange_identification: Connection closed by remote host

然后我在 Git Bash 中运行ssh -vvv git@localhost并获取消息

then I run ssh -vvv git@localhost in Git Bash and get message

debug2: ssh_connect: needpriv 0
debug1: Connecting to localhost [127.0.0.1] port 22.
debug1: Connection established.
debug1: identity file /c/Users/MoreFreeze/.ssh/identity type -1
debug3: Not a RSA1 key file /c/Users/MoreFreeze/.ssh/id_rsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace 
// above it repeats 24 times
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file /c/Users/MoreFreeze/.ssh/id_rsa type 1
debug1: identity file /c/Users/MoreFreeze/.ssh/id_dsa type -1
ssh_exchange_identification: Connection closed by remote host

似乎我的私钥格式错误?而且我发现私钥中恰好有25行,没有BEGINEND. 我很困惑为什么它说不是RSA1密钥,我完全确保它是RSA 2密钥.

it seems my private keys has wrong format? And I find that there are exactly 25 line in private keys without BEGIN and END. I'm confused why it said NOT RSA1 key, I totally ensure it is RSA 2 key.

欢迎任何建议. 顺便说一句,我已经在Google上阅读了有关此问题的前三页.

Any advises are welcome. btw, I have read first 3 pages on google about this problem.

推荐答案

我今天遇到了这个问题,我意识到我已经连接到2个不同的网络(LAN和WLAN),我解决了这个问题,只是断开了以太网适配器的电缆连接.我想可能是由于ssh密钥与我的无线适配器的MAC地址绑定引起的.希望对您有帮助.

I had this problem today and I realize that I was connected to 2 differente networks (LAN and WLAN), I solved it just disconnecting the cable from my Ethernet adapter. I suppose that the problem is caused because the ssh key is tied with the MAC address of my wireless adapter. I hope this helps you.

这篇关于ssh_exchange_identification:Git bash下的远程主机关闭了连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆