【问题标题】:gitlab - ssh_exchange_identification: read: Connection reset by peergitlab - ssh_exchange_identification:读取:连接由对等方重置
【发布时间】:2020-11-15 04:11:04
【问题描述】:

我正在尝试从我的 Macbook 上的 Gitlab 服务器进行克隆。当我克隆时,我收到以下错误:

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.

当我尝试 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

我可以毫无问题地使用 Google Chrome 访问 gitlab 服务器。我还尝试从不同的服务器克隆和 ssh 没有问题。我在这个 gitlab 服务器上没有管理员权限,但我不相信那里有任何禁止/黑名单软件。

谁能给点建议?

【问题讨论】:

    标签: ssh gitlab


    【解决方案1】:
    ssh_exchange_identification: read: Connection reset by peer
    

    这基本上意味着 TCP 连接在被服务器接受后立即为"reset"。造成这种情况的常见原因是:

    • 远程 SSH 服务器软件出现故障(例如崩溃)。
    • 远程 SSH 服务器软件被配置为出于某种原因断开您的连接。
    • 您和服务器之间的某些路由器或其他网络设备正在干扰 TCP 连接。

    无法从客户端调试消息中准确判断出什么问题。您需要在服务器上对此进行故障排除。例如,远程 SSH 服务器程序可能有一个您可以查看的日志文件。

    【讨论】:

      【解决方案2】:

      在我的服务器(Dockerized GitLab)上,问题是我在 /etc/gitlab 中为 sshd 的密钥提供了错误的权限,这可以通过检查 /var/log/gitlab/sshd 中的日志来查看。

      我通过使用以下命令更改服务器上的权限解决了这个问题:

      chmod -R 700 /etc/gitlab
      

      【讨论】:

        【解决方案3】:

        我遇到了类似的问题,我发现 /var/empty 文件夹的所有者错误。我运行了“sudo chown root /var/empty”,它解决了这个问题。

        【讨论】:

          【解决方案4】:

          我遇到了同样的错误。也许它是通用的,但我的问题是服务器有一些未提交的更改需要添加和提交,然后我才能从我的计算机推送更改。希望这可以节省一些时间,因为它浪费了几个小时。谢谢!

          【讨论】:

            【解决方案5】:

            我刚刚将 url 从 ssh 更改为 http 并修复了所有问题...

            git remote set-url origin https://username@gitclient.com/reposetory_address
            

            【讨论】:

              【解决方案6】:

              添加我的场景。就我而言,github 服务器是私有的,之前 github repo 服务器 ip 是固定的,我将它添加到 /etc/hosts 文件中。服务器ip在维护后更新了,但是hosts文件没有更新。我删除了 /etc/hosts 文件中的固定项目,错误消失了。 仅供参考,以防有人遇到同样的问题。

              【讨论】:

                猜你喜欢
                • 1970-01-01
                • 1970-01-01
                • 1970-01-01
                • 1970-01-01
                • 2015-05-15
                • 1970-01-01
                • 2019-02-14
                • 1970-01-01
                • 2018-11-01
                相关资源
                最近更新 更多