我的git推送在完成推送后被挂起。我要去 git推

Counting objects: 51, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (47/47), done.
Writing objects: 100% (47/47), 27.64 MiB | 6.47 MiB/s, done.
Total 47 (delta 4), reused 0 (delta 0)

它挂在这里,我必须control-c才能回到命令行。我已经在过去与这个项目没有问题的几次提交。我在我的机器上尝试过其他的回购,它们工作得很好。这是怎么回事?


当前回答

https://git-scm.com/docs/git-config#Documentation/git-config.txt-httppostBuffer

http.postBuffer Maximum size in bytes of the buffer used by smart HTTP transports when POSTing data to the remote system. For requests larger than this buffer size, HTTP/1.1 and Transfer-Encoding: chunked is used to avoid creating a massive pack file locally. Default is 1 MiB, which is sufficient for most requests. Note that raising this limit is only effective for disabling chunked transfer encoding and therefore should be used only where the remote server or a proxy only supports HTTP/1.0 or is noncompliant with the HTTP standard. Raising this is not, in general, an effective solution for most push problems, but can increase memory consumption significantly since the entire buffer is allocated even for small pushes.

决议

将Git缓冲区大小增加到回购中最大的单个文件大小 Git配置——global http。postBuffer 157286400 参考Git推送失败的解决方案-客户端打算为ngnix反向代理配置发送太大的块体。将此参数增加到回购中最大的单个文件大小。 绕过出站代理,因为git出站代理而无法克隆或拉取

其他回答

在我的例子中,遥控器的磁盘已经满了。删除远程上的一些文件立即解决了这个问题。

它可以(正如公认的答案所暗示的那样)等待片刻,但在大多数情况下,它与远程上的权限相关联。 虽然在GitHub、Gitlab或Bitbucket等公共git服务上大多数情况下都不是问题,但自托管远程服务器可能有一个特殊的用户或组来访问。

在新的裸存储库中,改变文件夹是不够的, 但需要递归,因为里面有。git- folder。

我也有同样的问题,推动提交到GitHub。在我的案例中,问题出在一个分支。我尝试用一个相对大的提交来推送本地分支,而没有一个远程分支git推送——set-upstream origin <你的分支名称>。我已经设法通过在GitHub上创建一个分支,然后推动提交来解决这个问题。

签出git正在使用的用户权限!

在我的情况下,我尝试通过ssh和使用的系统用户无法写入到git裸库…

下面是调试ssh连接的方法

在等了两个多小时后,我的git推送仍然卡住了。所以,我不得不在提交之前重置,我不小心上传了一张3.1mb的照片(我猜这是冻结的罪魁祸首)。

我发现了一个更友好的解决方案,@aroth在git配置上分享——global http。postBuffer 157286400是答案。

我只是打开一个新的iTerm窗口,运行上面的命令,然后运行git push,而VSCode中的终端仍然挂起。然后我按ctrl c关闭终端会话在VSCode和我回到业务。

谢谢@aroth!