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.
You can get "ssh_exchange_identification: Connection closed by remote host" if your
sshd
service is not operational!If you have access to the server check you have the
sshd
service running with:and check it is listening on port 22:
more details here
We migrated our git host instance/servers this morning to a new data center and while being connected to both: VPN (from remote/home) or when in office network, I got the same error and was not able to connect to clone any GIT repo.
This will help if you are connecting to some or all servers via a jump host server.
Earlier in my ~/.ssh/config file, my setting to connect were:
What this means is, for any SSH based connection, it will connect to any * server via the given jump host server except/by ignoring "ssh.somejumphost.my.company.com" server (as we don't want to connect to a jump host via jump host server.
To FIX the issue, all I did was, change the config to ignore git server as well:
So, now to connect to mycompany-git.server.com while doing git clone (git SSH url), I'm telling SSH not to use a jump host for those two extra git instances/servers.
Hit the following
ssh restart
command in linuxMake sure you are not connect to any kind of VPN.
Got the same error message. Turning off WiFi and turning it back on again worked for me.
Simple server reboot solved the problem for me. Try hard reboot , if dont work after soft reboot.