git push 时报错:

$ git push --set-upstream origin dev
Enumerating objects: 25166, done.
Counting objects: 100% (25166/25166), done.
Delta compression using up to 4 threads
Compressing objects: 100% (8056/8056), done.
error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413
send-pack: unexpected disconnect while reading sideband packet
Writing objects: 100% (25166/25166), 11.70 MiB | 23.27 MiB/s, done.
Total 25166 (delta 19384), reused 22393 (delta 16764), pack-reused 0
fatal: the remote end hung up unexpectedly
Everything up-to-date

之前处理过一个类似的报错:git push报错:“RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function.”。方案大致如下:

git config --global http.postBuffer 524288000

这次修改之后再次提交仍然报错。

最后找到一个方案提到需要修改 web 服务器的 client_max_body_size(httpd.conf):

...
http {
...
client_max_body_size 100m;
}
...

报错之后,重载 Nginx 配置 nginx -s reload之后,再次尝试 git push,成功!