git http 方式 push 出现 RPC failed 或Entity Too Large 完美解决方案
error: unable to rewind rpc post data - try increasing http.postBuffer
error: RPC failed; curl 56 Recv failure: Connection was aborted
fatal: The remote end hung up unexpectedly
当使用git 一次提交的数据过大时,会出现以上错误,按照提示我们增大postBuffer
git config http.postBuffer 524288000,改为最大500M 具体值先检查一下原始工程)
http 连接方式 ,一般的问题,用增加postBuffer一般可以解决,但对于超大的代码(700MB+,我的经验)加了这个缓存没用,
显示详细信息
GIT_CURL_VERBOSE=1 git push -u origin master
改到很大后(检测要提交代码的大小,并设置postBuffer为对应大小,如果太大会出现以下错误
error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413 Request Entity Too Large
解决办法:在部署NGINX(Apache思路相同)做反向代理的gitlab服务器所在机器(容器运行时,仅需要更改主机即可),更改client_max_body_size配置。
这是因为nginx的配置中进行了限制(我这里nginx作为反向代理),对proxy_pass.conf(也可以是nginx.conf,根据实际情况)中的相应参数进行放大,解决了此问题。
client_max_body_size 512M;(更改前 128m)
client_body_buffer_size 512k;(更改前 64k)
proxy_connect_timeout 300;
proxy_send_timeout 300;
proxy_read_timeout 300;
proxy_buffer_size 16k;
proxy_buffers 4 16k;
proxy_busy_buffers_size 48k;
proxy_temp_file_write_size 512k;(更改前 64k)
proxy_max_temp_file_size 512m;(更改前 128m)