h8n2
h8n2

Reputation: 679

gitlab - ssh_exchange_identification: read: Connection reset by peer

I am trying to clone from a Gitlab server from my Macbook. When I clone, I get the following error:

manzanita-226-109:icarus homeuser$ git clone elm:dummy/dummy.git
Cloning into 'dummy'...

ssh_exchange_identification: read: Connection reset by peer
fatal: Could not read from remote repository.

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

When I try to ssh into the gitlab server, I get the following:

OpenSSH_7.6p1, LibreSSL 2.6.2
debug1: Reading configuration data /Users/homeuser/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to elm.ndc.nasa.gov port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /Users/homeuser/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/homeuser/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/homeuser/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/homeuser/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/homeuser/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/homeuser/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/homeuser/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/homeuser/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6
ssh_exchange_identification: read: Connection reset by peer

I can get on the gitlab server using Google Chrome with no issues. I also tried cloning and ssh'ing from a different server with no issues. I do not have admin privileges on this gitlab server, but I do not believe there are any banning/blacklisting softwares on there.

Can anyone advise?

Upvotes: 4

Views: 22231

Answers (6)

cynkiller
cynkiller

Reputation: 83

Add my scenario. In my case, github server is private, previously the github repo server ip is fixed, and I add it in /etc/hosts file. The server ip was updated after maintainance but the hosts file is not updated. I removed the fixed item in /etc/hosts file and the error is gone. Just for reference in case anyone hit the same issue.

Upvotes: 0

Awais Jameel
Awais Jameel

Reputation: 2206

I just changed url from ssh to http and it fixed everything...

git remote set-url origin https://[email protected]/reposetory_address

Upvotes: 1

Ryan Jarvis
Ryan Jarvis

Reputation: 61

I had this same error. Maybe it is generic, but my issue was that the server had some uncommitted changes that needed to be added and committed before I could push changes from my computer. Hope this saves someone some time, since it wasted a few hours. Thanks!

Upvotes: 0

Jonathan Persson
Jonathan Persson

Reputation: 451

On my server (Dockerized GitLab) the problem was that I had given the wrong permissions to sshd's keys in /etc/gitlab which could be seen by inspecting the logs in /var/log/gitlab/sshd.

I solved the problem by changing the permissions on the server with this command:

chmod -R 700 /etc/gitlab

Upvotes: 2

Robbie Reichard
Robbie Reichard

Reputation: 31

I had a similar issue and I found out that the /var/empty folder had the wrong owner. I ran " sudo chown root /var/empty " and it resolved the issue.

Upvotes: 2

Kenster
Kenster

Reputation: 25439

ssh_exchange_identification: read: Connection reset by peer

This basically means the TCP connection was "reset" immediately after being accepted by the server. Common reasons for this are:

  • The remote SSH server software is malfunctioning (e.g. it crashed).
  • The remote SSH server software is configured to drop your connections for some reason.
  • Some router or other networking device between you and the server is interfering with the TCP connection.

There's no way to tell exactly what is wrong from the client debugging messages. You need to troubleshoot this on the server. The remote SSH server program might have a log file you can look at, for example.

Upvotes: 10

Related Questions