[转]Git Push Fails - fatal: The remote end hung up unexpectedly

Symptoms

When users try to run "git push" the following error message is shown:

$ git push
Counting objects: 2332669, done .
Delta compression using up to 16 threads.
Compressing objects: 100% (360818 /360818 ), done .
error: RPC failed; result=22, HTTP code = 411
fatal: The remote end hung up unexpectedly
Writing objects: 100% (2332669 /2332669 ), 483.30 MiB | 114.26 MiB /s , done .
Total 2332669 (delta 1949888), reused 2330461 (delta 1949349)
fatal: The remote end hung up unexpectedly

Cause

The "Smart HTTP" protocol in Git uses "Transfer-Encoding: chunked" in POST requests when it contains packed objects greater than 1MB in size.

Some proxy servers, like Nginx, do not support this transfer encoding by default, and the requests will be rejected before they get to Stash. Because of this, the Stash logs will not show any extra information.

Workaround

The default size at which the Git client starts "chunking" the request is 1MB. Users can change this setting using:

git config http.postBuffer 524288000

Where the number used will have to be large enough for the push. The example above is 500MB. In the case of an initial push when setting up Stash, this is the size of the repository.

Unfortunately, each user has to set this value, and it will need to be large enough for all the Git pushes.

Resolution

Configure the proxy server to handle "Transfer-Encoding: chunked". For Nginx the HttpChunkinModule module will need to be installed.

原文网址:https://confluence.atlassian.com/display/STASHKB/Git+Push+Fails+-+fatal%3A+The+remote+end+hung+up+unexpectedly

 

 

 

error: RPC failed; result=22, HTTP code = 413
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
Everything up-to-date

 

使用了Nginx 1.4并且按照安装文档的提示使用了默认的配置文件:

[code lang="shell"]sudo cp lib/support/nginx/gitlab /etc/nginx/sites-available/gitlab
sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab[/code]

而这个默认的lib/support/nginx/gitlab配置文件却没有设定允许的最大POST大小,因此Nginx使用了默认值2M为允许的最大POST大小,而Kaijia提交大小已经超过了2M,因此上传到一半会出现中断。明白原因后解决方法就非常简单了,只需要在GitLab Nginx配置文件(/etc/nginx/sites-available/gitlab)中的server段中增加:

[code lang="shell"]client_max_body_size 128M;[/code]

将128M修改为你希望允许的最大POST大小,保持配置文件后重新启动Nginx,就可以正常上传了。

 

http://www.kaijia.me/2013/10/gitlab-fatal-the-remote-end-hung-up-unexpectedly-solved/

你可能感兴趣的:(git)