3

I am getting the following error when I attempt to clone a repository using SSH:

$ git clone ssh://[email protected]:7999/eqt/myproject.git
Cloning into 'myproject'...
Read from socket failed: Connection reset by peer
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

The ssh keys are stored in a shared drive, and I have no problems performing the same clone from another machine that also uses the shared drive. My problem is with my Windows 7 laptop.

I tried to debug the ssh connection and ran the following command:

$ ssh -Tvvv [email protected] -p 7999
OpenSSH_6.6.1, OpenSSL 1.0.1i 6 Aug 2014
debug2: ssh_connect: needpriv 0
debug1: Connecting to stash.mydomain.com [10.105.255.156] port 7999.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/p/.ssh/id_rsa" as a RSA1 public key
debug1: identity file /p/.ssh/id_rsa type 1
debug1: identity file /p/.ssh/id_rsa-cert type -1
debug1: identity file /p/.ssh/id_dsa type -1
debug1: identity file /p/.ssh/id_dsa-cert type -1
debug1: identity file /p/.ssh/id_ecdsa type -1
debug1: identity file /p/.ssh/id_ecdsa-cert type -1
debug1: identity file /p/.ssh/id_ed25519 type -1
debug1: identity file /p/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1
debug1: Remote protocol version 2.0, remote software version SSHD-CORE-0.9.0-ATLASSIAN-1
debug1: no match: SSHD-CORE-0.9.0-ATLASSIAN-1
debug2: fd 3 setting O_NONBLOCK
debug3: put_host_port: [stash.mydomain.com]:7999
debug3: load_hostkeys: loading entries for host "[stash.mydomain.com]:7999" from file "/p/.ssh/known_hosts"
debug3: load_hostkeys: found key type RSA in file /p/.ssh/known_hosts:2
debug3: load_hostkeys: loaded 1 keys
debug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],[email protected],ssh-rsa
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-
debug2: kex_parse_kexinit: [email protected],[email protected],ssh-rsa,[email protected],[email protected],ecdsa-sha2-nistp521-cert-
stp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,[email protected],[email protected],[email protected],aes128-cbc,3des-cbc,blowfish-cbc,cast128-c
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,[email protected],[email protected],[email protected],aes128-cbc,3des-cbc,blowfish-cbc,cast128-c
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-ripemd16
[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-ripemd16
[email protected],hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,[email protected],zlib
debug2: kex_parse_kexinit: none,[email protected],zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa
debug2: kex_parse_kexinit: aes128-ctr,aes128-cbc,3des-cbc,blowfish-cbc
debug2: kex_parse_kexinit: aes128-ctr,aes128-cbc,3des-cbc,blowfish-cbc
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-md5-96,hmac-sha1-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-md5-96,hmac-sha1-96
debug2: kex_parse_kexinit: none
debug2: kex_parse_kexinit: none
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_setup: setup hmac-md5
debug1: kex: server->client aes128-ctr hmac-md5 none
debug2: mac_setup: setup hmac-md5
debug1: kex: client->server aes128-ctr hmac-md5 none
debug2: bits set: 1008/2048
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
Read from socket failed: Connection reset by peer

What might be the issue here? My ssh keys seem fine, but it seems like this connection is being blocked somewhere. I'm not familiar enough with SSH to know where to look.

9
  • The remote server is dropping the connection while setting up the secure channel. You'll need to troubleshoot the server. Commented Oct 3, 2014 at 19:45
  • The server can't be the problem though. As I said above, the exact same request is working on another machine Commented Oct 3, 2014 at 20:30
  • 2
    "Connection reset by peer" literally means the other end of the connection closed it. In fact, it means there was an "abortive close" by the remote end instead of a normal close. A program crash can cause that. Commented Oct 3, 2014 at 20:42
  • you can clone your project by using HTTPS link by providing username and password. Use this command 'git clone httpslink' and please let me know whether it is cloning successfully or not. Commented Oct 7, 2014 at 11:59
  • 3
    What do you get if you run the erroring SSH command with the output shown above on a client that works? The difference between the two debug logs might be enlightening. Commented Oct 8, 2014 at 8:31

1 Answer 1

4
+50

The server can't be the problem though

I would still check the server sshd logs to be sure (/var/log/auth.log) (increasing the LogLevel in the sshd config can help too)

You can try and testing ssh through MobaXterm (just for test), since it has a Workaround for "connection reset by peer" issue.

You can check if it is a Cipher issue (on the client side).

Finally, you can try and regenerate a new pair of public/private keys, publish the public one on the server, and check if the issue persists.

Sign up to request clarification or add additional context in comments.

1 Comment

As from URL we can deduct that @DJ180 is using stash, there is no ssh process involved, just java library. Specifically Apache SSH

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.