[英]gitlab - ssh_exchange_identification: read: Connection reset by peer
I am trying to clone from a Gitlab server from my Macbook.我正在尝试从我的 Macbook 从 Gitlab 服务器克隆。 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:当我尝试通过 ssh 进入 gitlab 服务器时,我得到以下信息:
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.我可以毫无问题地使用 Google Chrome 访问 gitlab 服务器。 I also tried cloning and ssh'ing from a different server with no issues.我还尝试从不同的服务器克隆和 ssh'ing,没有任何问题。 I do not have admin privileges on this gitlab server, but I do not believe there are any banning/blacklisting softwares on there.我在这个 gitlab 服务器上没有管理员权限,但我不相信那里有任何禁止/黑名单软件。
Can anyone advise?任何人都可以建议吗?
ssh_exchange_identification: read: Connection reset by peer
This basically means the TCP connection was "reset" immediately after being accepted by the server.这基本上意味着 TCP 连接在被服务器接受后立即“重置” 。 Common reasons for this are:造成这种情况的常见原因有:
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.例如,远程 SSH 服务器程序可能有一个您可以查看的日志文件。
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.在我的服务器(Dockerized GitLab)上,问题是我对 /etc/gitlab 中的 sshd 密钥授予了错误的权限,这可以通过检查 /var/log/gitlab/sshd 中的日志来查看。
I solved the problem by changing the permissions on the server with this command:我通过使用以下命令更改服务器上的权限解决了这个问题:
chmod -R 700 /etc/gitlab
I had a similar issue and I found out that the /var/empty folder had the wrong owner.我有一个类似的问题,我发现 /var/empty 文件夹的所有者错误。 I ran " sudo chown root /var/empty " and it resolved the issue.我运行了“ sudo chown root /var/empty ”,它解决了这个问题。
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!谢谢!
我只是将 url 从 ssh 更改为 http 并修复了所有内容...
git remote set-url origin https://username@gitclient.com/reposetory_address
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.就我而言,github 服务器是私有的,以前 github repo 服务器 ip 是固定的,我将其添加到 /etc/hosts 文件中。 The server ip was updated after maintainance but the hosts file is not updated.维护后服务器ip已更新,但主机文件未更新。 I removed the fixed item in /etc/hosts file and the error is gone.我删除了 /etc/hosts 文件中的固定项,错误消失了。 Just for reference in case anyone hit the same issue.仅供参考,以防有人遇到同样的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.