Git 大文件更改推送错误
遇到一个错误,信息如下;
Enumerating objects: 4097, done.
Counting objects: 100% (4097/4097), done.
Delta compression using up to 4 threads
Compressing objects: 100% (764/764), done.
client_loop: send disconnect: Connection reset by peer/s
fatal: the remote end hung up unexpectedly | 42.00 KiB/s
fatal: sha1 file '<stdout>' write error: Broken pipe
fatal: the remote end hung up unexpectedly
原因:
-
Git 中的“智能 HTTP”协议在 POST 请求中使用“Transfer-Encoding:chunked”,当它包含大小超过 1MB 的打包对象时。某些代理服务器(如 Nginx)默认情况下不支持此传输编码,请求将在到达 Bitbucket Server 之前被拒绝。因此,Bitbucket Server 日志不会显示任何额外信息。
-
可能的原因是负载均衡器配置错误,即是网速不好的时候。
-
GitHub 提交文件的时候,当文件很大的时候,就会提醒;因为 GitHub 默认不允许提交超过 100M 的文件。
解决方案:
当推送大量数据时(初始推送大型存储库,使用非常大的文件进行更改)可能需要 http.postBuffer 在 git 客户端 (而不是服务器)上设置更高的 设置 ;将 Git 缓冲区大小增加到 repo 的最大单个文件大小:
git config --global http.postBuffer 157286400