How do I fix `fatal: the remote end hung up unexpectedly` while pushing from a Bitbucket pipeline to

While pushing to Platform git repository from our Bitbucket runner, the pipeline fails with the following error: fatal: the remote end hung up unexpectedly .
How can I fix that?

Bitbucket pipelines support the git clone --depth option which can cause this error.

This feature allows Bitbucket pipelines to fetch only a subset of your repository commit history as opposed to the full commit history. Unfortunately, when the pipeline pushes an incomplete history to your Platform repository, the Platform git server hangs and terminates transfer, causing your pipeline to fail with fatal: the remote end hung up unexpectedly.

Until we support shallow clones, the solution is to disable them. Setting depth: full in the bitbucket-pipelines.yml as shown in the below YAML block.

  depth: full

See the following documentation for further information:

And for Gitlab, you will need to set git depth to 0 as described here.

1 Like