Gitlab SSH 连接超时,但使用 HTTP(S) 工作正常



提示:SSH密钥在我的机器和Gitlab上配置得很好,所以显然这不是身份验证问题,而是连接问题。

当我连接到我的家庭网络并尝试通过 SSH 连接到 Gitlab 时,(ssh -v git@gitlab.com)连接超时并失败。 然后进程尝试再次连接,现在使用 IPv4,然后连接成功(等待几分钟后(,这是输出:

OpenSSH_7.4p1 Debian-10+deb9u7, OpenSSL 1.0.2u  20 Dec 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to gitlab.com [2606:4700:90:0:f22e:fbec:5bed:a9b9] port 22.
debug1: connect to address 2606:4700:90:0:f22e:fbec:5bed:a9b9 port 22: Connection timed out
debug1: Connecting to gitlab.com [172.65.251.78] port 22.
debug1: Connection established.

但是,如果我连接到任何其他网络,则连接成功,导致以下输出:

OpenSSH_7.4p1 Debian-10+deb9u7, OpenSSL 1.0.2u  20 Dec 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to gitlab.com [172.65.251.78] port 22.
debug1: Connection established.

显然,这是我的家庭网络或Gitlab上的问题,但是我已经尝试了所有方法,并尝试了很多可能的解决方案,但没有成功。

任何帮助都非常感谢。

我遇到了同样的问题。这是我的网络。我尝试使用 ping http://ipv6now.com.au/pingme.php gitlab,它奏效了。当我从本地工作站发出ping命令时,它不起作用。http://sf-alpha.bjgang.org/wordpress/2012/08/linux-prefer-ipv4-over-ipv6-in-dual-stack-environment-and-prevent-problems-when-only-ipv4-exists/,我使用在此处找到的说明将工作站更改为首选ipv4。从本质上讲,我取消了注释并将/etc/gai.conf 中的行从precedence ::ffff:0:0/96 10precedence ::ffff:0:0/96 100

最新更新