Gitlab - 无法推送到存储库只是挂起



无法推送到master,控制台冻结,没有任何响应。仅在运行之后

git config --global http.postBuffer 524288000

git push运行良好。

虽然设置似乎是一次,但下次使用git push时会出现同样的问题。有其他解决方案吗?为什么会突然发生这种事?

编辑:

OpenSSH_7.9p1, LibreSSL 2.7.3 debug1: Reading configuration data /Users/name/.ssh/config debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 48: Applying options for * debug2: resolving "gitlab.com" port 22 debug2: ssh_connect_direct debug1: Connecting to gitlab.com [2606:4700:90:0:f22e:fbec:5bed:a9b9] port 22. debug1: Connection established. debug1: identity file /Users/name/.ssh/id_rsa type 0 debug1: identity file /Users/name/.ssh/id_rsa-cert type -1 debug1: identity file /Users/name/.ssh/id_dsa type -1 debug1: identity file /Users/name/.ssh/id_dsa-cert type -1 debug1: identity file /Users/name/.ssh/id_ecdsa type -1 debug1: identity file /Users/name/.ssh/id_ecdsa-cert type -1 debug1: identity file /Users/name/.ssh/id_ed25519 type -1 debug1: identity file /Users/name/.ssh/id_ed25519-cert type -1 debug1: identity file /Users/name/.ssh/id_xmss type -1 debug1: identity file /Users/name/.ssh/id_xmss-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_7.9

您看到的是某种网络问题。您可以连接到远程系统,但无法读取远程端的版本字符串,这是它作为SSH协议的一部分发送的第一个内容。

很可能是你的系统中有什么东西阻止了数据的发送或接收,或者是你的网络中有什么原因导致了这种情况。根据OpenSSH版本字符串,你似乎在macOS上,所以你应该检查防火墙配置。如果您在系统上安装了防病毒软件,请将其删除,然后重新启动。有些网络会阻塞SSH,所以这也可能是问题所在。如果尝试ssh git@github.com没有挂起,那么这可能是因为您的网络中断了IPv6支持或路径MTU发现,在这种情况下,您应该检查您的路由器。你可以从另一个网络尝试(如果可能的话,考虑到当前事件(,看看这是否解决了问题,在这种情况下,你知道这是你的网络上的问题。

这里潜在的问题太多了,不可能一一列举。更改http.postBuffer肯定没有帮助,因为这对SSH根本没有影响,只会影响服务器或代理破坏HTTP/1.1支持的HTTPS连接。除非你知道自己需要它,否则不应该设置它,因为它会导致每个HTTPS推送操作,无论多么小,都要分配全部内存,所以在几乎所有情况下,它都没有带来任何好处,只是不必要地浪费了大量内存。

您也可以尝试切换到HTTPS URL。有时,出于某种原因,这种方法效果更好。

最新更新