案发现场
使用 git 将本地的代码,推送到远程仓库时,推送失败(使用的http协议)。错误信息如下:
$ git push
Enumerating objects: 3383, done.
Counting objects: 100% (3383/3383), done.
Delta compression using up to 8 threads
Compressing objects: 100% (1216/1216), done.
Writing objects: 100% (3383/3383), 6.96 MiB | 81.92 MiB/s, done.
Total 3383 (delta 2303), reused 3007 (delta 2034), pack-reused 0
error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413
send-pack: unexpected disconnect while reading sideband packet
fatal: the remote end hung up unexpectedly
Everything up-to-date
解决方案
本次 push 的数据大小为 17M。
一、从 Git 的角度解决问题,可以增加 http.postBuffer 的大小
git config http.postBuffer 524288000
二、因为我的 Gitlab 服务是用 Nginx 做了域名代理,所以可能是 nginx 的 client_max_body_size 的限制,可以做如下调整:
client_max_body_size 1024m;
解决Git大文件推送超限问题:调整http.postBuffer与Nginx配置
本文探讨了如何在尝试将17M大小的代码推送至远程Git仓库时遇到413错误,通过增大Git的http.postBuffer设置及Nginx的client_max_body_size来解决此问题,适合Git用户遇到类似推送限制时参考。
1839

被折叠的 条评论
为什么被折叠?



