Git Clone Fails - fatal: The remote end hung up unexpectedly. fatal: early EOF fatal: index-pack failed

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Problem

During a clone or fetch, Git fails with the following errors:

Example 1
git clone http://bitbucket.company.com:7990/scm/proj/repo.git
fatal: early EOF
fatal: The remote end hung up unexpectedly
fatal: index-pack failed
error: RPC failed; result=56, HTTP code = 200
Completed with errors, see above.
Example 2

git clone fails after 1 GB

git clone http://bitbucket.company.com:7990/scm/proj/repo.git. Cloning into 'repo'....git
remote: Counting objects: , done.
remote: Compressing objects: 100% (####/###), done.
fatal: The remote end hung up unexpectedly.00 GiB | MiB/s
fatal: early EOF
fatal: index-pack failed

and in atlassian-bitbucket.log 

2017-07-26 12:39:18,819 INFO  [http-nio-7990-exec-8] <user> @4MMSRUx758x33193x0 <IP> "POST /scm/team/<repo>/git-upload-pack HTTP/1.0" c.a.s.i.w.filters.StreamGuardFilter The remote client has aborted the connection


Diagnosis

This behavior is usually related to an intermediary that is terminating the request. Removing the intermediary from the equation and checking if the import would work can speed up the troubleshooting process.

(info)  For that, temporarily disable any firewall or anti-virus software and attempt the clone again or make an exception rule in the firewall settings.


To turn on Git debug logging, before pushing using the command line, proceed like this for different OS:

On Linux

Execute the following in the command line before executing the Git command:

export GIT_TRACE_PACKET=1
export GIT_TRACE=1
export GIT_CURL_VERBOSE=1

On Windows

Execute the following in the command line before executing the Git command:

set GIT_TRACE_PACKET=1
set GIT_TRACE=1
set GIT_CURL_VERBOSE=1

Cause

Possible causes include:

  • Cause #1 git debug output has error: RPC failed; result=56, HTTP code = 200
    Error code 56 indicates a curl receive error of CURLE_RECV_ERROR which means there was some issue that prevented the data from being received during the clone process. Typically this is caused by a network setting, firewall, VPN client, or anti-virus that is terminating the connection before all data has been transferred.
  • Cause #2 There is no error code and git debug log shows that Nginx is configured as reverse proxy. Git clone fails after 1 GB.
    e.g.

    < HTTP/1.1 200
    < Server: nginx/1.10.2

Workaround

Workaround for Cause #1: Switch to using SSH to perform the clone. 

Workaround for Cause #2: Bypass the proxy and clone. e.g. How do I bypass a proxy for bitbucket server

Resolution

  • Resolution for Cause #1:
    Change the anti-virus settings, firewall settings, or VPN client so that they allow connections from Bitbucket Server and do not terminate them prematurely. The specific change that needs to be done will depend on the technology being used and sometimes it will be helpful to check the vendor documentation.
  • Resolution for Cause #2:
    Disable the default 1GB limit of proxy_max_temp_file_size for Nginx. Value need to be set as zero to disable it
    You can find more details here http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_max_temp_file_size . 

Description

During a clone or fetch, Git fails with EOF errors.

ProductBitbucket
Last modified on Feb 1, 2022

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.