SSH 错误 kex_exchange_identification 忽略 ConnectionAttempts?

SSH 错误 kex_exchange_identification 忽略 ConnectionAttempts?

我有一个用于构建程序的 CI/CD。该程序具有多个依赖项,托管在私有 GitLab 上。这些依赖项通过 GIT 使用 SSH 下载。这个私有 GitLab 非常不稳定,防火墙拒绝多个连接,很多时候我的 CI/CD 无法工作,因为服务器拒绝连接。

我做了一些研究,发现 SSH 有一个名为的设置ConnectionAttempts,它是连接尝试的次数,但是当我收到 kex_exchange_identification 错误时,SSH 不会再次尝试连接。

错误是否会kex_exchange_identification按时暂停 SSH 执行并忽略 ConnectionAttempts?有没有办法为此编程重试?

完整错误:

OpenSSH_8.4p1 Debian-5+deb11u1, OpenSSL 1.1.1n  15 Mar 2022
debug1: Reading configuration data /root/.ssh/config
debug1: /root/.ssh/config line 1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/root/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/root/.ssh/known_hosts2'
debug2: resolving "gitlab.luizalabs.com" port 22
debug2: ssh_connect_direct
debug1: Connecting to gitlab.luizalabs.com [x5.xx7.2xx.xx] port 22.
debug2: fd 3 setting O_NONBLOCK
debug1: fd 3 clearing O_NONBLOCK
debug1: Connection established.
debug3: timeout: 299884 ms remain after connect
debug1: identity file /root/.ssh/id_rsa type 0
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa_sk type -1
debug1: identity file /root/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: identity file /root/.ssh/id_ed25519_sk type -1
debug1: identity file /root/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /root/.ssh/id_xmss type -1
debug1: identity file /root/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.4p1 Debian-5+deb11u1
kex_exchange_identification: Connection closed by remote host
Connection closed by x5.xx7.2xx.xx port 22
fatal: Could not read from remote repository.

相关内容