nginx 代理 gitlab 时的 413 问题

git push 时出现:

Counting objects: 80, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (75/75), done.
fatal: The remote end hung up unexpectedly
Writing objects: 100% (80/80), 42.70 MiB | 12.01 MiB/s, done.
Total 80 (delta 47), reused 0 (delta 0)
error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413 Request Entity Too Large
fatal: The remote end hung up unexpectedly
Everything up-to-date

可以先尝试

git config --global http.postBuffer 524288000

同时检查 nginx 配置,在 nginx.confhttp 中添加:

client_max_body_size 100m;

100m 值取决于报错的大小。