我在win7的工作,并成立了git的服务器的sshd。 我git --bare init myapp.git
,并克隆ssh://git@localhost/home/git/myapp.git
在Cywgin正确。 但我又需要的Cygwin配置混帐,我想在Git中击与git克隆。 我运行git clone ssh://git@localhost/home/git/myapp.git
并获得以下消息
ssh_exchange_identification: Connection closed by remote host
然后我跑ssh -vvv git@localhost
Git的Bash和获取信息
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行没有BEGIN
和END
。 我很困惑,为什么它说的不是RSA1关键,我完全确保它是RSA 2密钥。
所有建议都欢迎。 顺便说一句,我看过关于这个问题谷歌首次3页。
Answer 1:
我今天有这个问题,我知道我是连接到2个differente网络(LAN和WLAN),我解决它只是从我的以太网适配器断开电缆。 我想这是因为SSH密钥与我的无线网卡的MAC地址捆绑的问题引起的。 我希望这可以帮助你。
Answer 2:
我只是遇到了这个如今,这是因为服务器我试图连接到与处理超载。 所以有可能是服务器的内存或CPU饿死。
Answer 3:
只需在服务器端输入:
echo 'SSHD: ALL' >> /etc/hosts.allow
它整理出来给我。
Answer 4:
打下面ssh restart
在Linux命令
prayag@prayag:~/backup/NoisyNeighbour$ service ssh restart
stop: Rejected send message, 1 matched rules; type="method_call", sender=":1.75" (uid=1417676764 pid=5933 comm="stop ssh ") interface="com.ubuntu.Upstart0_6.Job" member="Stop" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")
start: Rejected send message, 1 matched rules; type="method_call", sender=":1.76" (uid=1417676764 pid=5930 comm="start ssh ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")
Answer 5:
Answer 6:
得到了相同的错误消息。 关闭WiFi和重新打开工作把它给我。
Answer 7:
如果主机名不工作,尝试的IP地址。
此所以我现在不得不说是怎么回事。 我试图用我的主机名到SSH和它不工作
ssh root@host.example.net
这给出了错误“ssh_exchange_identification:连接被远程主机关闭”
这在过去一小时下班回来。
但这里是最有趣的部分,IP地址的作品!
ssh root@192.168.0.100
(当然实际的IP地址是不同的)
去搞清楚!
Answer 8:
删除/删除后rm ~/.ssh/known_hosts
,我的问题是固定的
Answer 9:
您好我解决这个问题的一个VPS服务,重新启动它,另一种方式是,如果您是从服务Ø任何其他方式有一个控制台来在你的远程机器运行命令你必须运行的唯一命令是重新启动ssh守护进程和享受! :P
/etc/init.d/ssh restart
Answer 10:
我解决它改变ssh端口&MaxStartups变量在/ etc / SSH / sshd_config中后,
port 2244
MaxStartups 100
然后,重新启动服务
service sshd restart
如果它仍然不能正常工作,请重新启动您的系统。
Answer 11:
今天上午,我们迁移我们的混帐主机实例/服务器到一个新的数据中心,同时连接到这两个:VPN(从远程/本地),或者在办公网络,我得到了同样的错误,是无法连接到克隆任何GIT回购。
Cloning into 'some_repo_in_git_dev'...
ssh_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.
这将有助于如果你是通过跳跃的主机服务器连接到一些或所有服务器。
在我的〜/ .ssh / config文件早些时候,我的设置,以连接为:
Host * !ssh.somejumphost.my.company.com
ProxyCommand ssh -q -W %h:%p ssh.somejumphost.my.company.com
这意味着,任何基于SSH连接,它会通过给定的跳跃主机服务器连接到任何*服务器/除外忽略 “ssh.somejumphost.my.company.com”服务器(因为我们不希望连接到通过跳跃主机服务器跳转主机。
要解决这个问题,我所做的是,更改配置忽略git的服务器,以及:
Host * !ssh.somejumphost.my.company.com !mycompany-git.server.com !OrMyCompany-some-other-git-instance.server.com
ProxyCommand ssh -q -W %h:%p ssh.somejumphost.my.company.com
所以,现在连接到mycompany-git.server.com,而这样做的git克隆(GIT SSH网址),我告诉SSH不使用主机跳为这两个额外的git的实例/服务器。
Answer 12:
类似阿伦Sangal问题在谎称的.ssh / config条目
Host my.sshhost.com
ProxyCommand ssh -q -W %h:%p myremotemachine.my.company.com
加入远程机器,以避免与SSH进行VPN连接和运作良好。 但对于假期期间,我关掉myremotemachine碰上了上述问题。
Answer 13:
连接到GitHub上使用ssh当我从一个工作地点移动到另一个得到了同样的错误了。 根据我的情况,似乎是不同网络的DNS服务器可能会github上的各IP地址和known_hosts文件无法识别它,当发生了变化。 因此,改变DNS或切换回原来的网络可以正常工作。
Answer 14:
你可以得到“ssh_exchange_identification:连接被远程主机关闭”如果你的sshd
服务不能运行!
如果你有访问服务器检查是否具有sshd
与运行服务:
ps aux | grep ssh
并检查它在端口22听:
netstat -plant | grep :22
更多的细节在这里
Answer 15:
对我来说,这是由并发SSH会话数的限制造成的。 我加了两个参数下面的/ etc / SSH / sshd_config中,然后事情的来龙去脉。
echo 'MaxSessions 2000' >> /etc/ssh/sshd_config
echo 'MaxStartups 2000' >> /etc/ssh/sshd_config
service ssh restart
Answer 16:
简单的重新启动服务器解决了这个问题对我来说。 努力重启,如果软重启后不工作。
Answer 17:
文章来源: ssh_exchange_identification: Connection closed by remote host under Git bash