Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ssh_exchange_identification: Connection closed by remote host under Git bash

Tags:

git

ssh

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 

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 

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.

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

like image 682
MoreFreeze Avatar asked Apr 12 '12 16:04

MoreFreeze


People also ask

How do I fix remote host connection closed?

This message indicates that the load on Git Fusion exceeds the MaxStartups value set in the sshd_config file. Adjust this setting to resolve this issue; we recommend a minimum value of at least 100. The sshd_config file is normally located in the directory /etc/ssh/sshd_config .

What causes Ssh_exchange_identification Connection closed by remote host?

While in many cases the ssh_exchange_identification: Connection closed by remote host error can be caused by issues related to the hosts. deny and hosts. allow configuration files, there are other things that can cause the problem.

What is Ssh_exchange_identification?

Recently one of our customers was trying to SSH into a server, but it returned the error, ssh_exchange_identification: Connection closed by remote host. This error indicates that the remote host closed the connection suddenly. This is a common error that users get when they try to connect to SSH servers.


1 Answers

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.

like image 148
PachinSV Avatar answered Sep 24 '22 01:09

PachinSV