Git Push Error: error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413

Crime scene

When using git to push the local code to the remote warehouse, the push fails (using the HTTP protocol). The error message is as follows:

$ 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

Solution:

The data size of this push is 17m.

1. To solve the problem from the perspective of GIT, you can add the size of http.postBuffer

git config http.postBuffer 524288000

2. Because my Gitlab service is using Nginx as a domain proxy, it is possible that the client_max_body_size of nginx is limited and can be adjusted as follows.

client_max_body_size 1024m;

Read More: