Resolve 'git upload-pack' Error When Cloning Bitbucket Data Center Repo

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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

Summary

Fix 'git upload-pack' Error When Using --mirror Option in Bitbucket Data Center.

Diagnosis

When cloning a repository hosted on Bitbucket Data Center using the --mirror option, the clone operation fails, and the following error is displayed:

fatal: git upload-pack: not our ref 0000000000000000000000000000000000000000

The error does not occur when cloning the repository without the --mirror option.

This problem can occur in any version of Bitbucket Data Center.

Cause

This error can occur if there are so-called pull request refs in the repository that are empty. These are Bitbucket-internal refs (references) to commits involved in a pull request (the source and destination branch) that can sometimes stay left behind empty if a pull request is deleted. These pull request refs are not cloned normally, which explains why the problem only occurs when using the --mirror option.

Solution

To resolve this issue, identify the empty pull request refs.

1. Enable debug logging for the git client. This needs to be done on the workstation where you are performing the failing clone from.

2. Re-run the failing clone operation

3. Inspect the output produced by the command - you should see one or more lines similar to the following:

pkt-line.c:80 packet: clone< 0000000000000000000000000000000000000000 refs/pull-requests/1

This line tells you that the ref refs/pull-requests/1 is empty and that ref needs to be removed. If there is more than one line like that, you will need to repeat step 9 below for each of those refs.

4. Open the repository in question in the Bitbucket Data Center web UI and navigate to the repository settings by clicking the “cog” icon.

5. Note the “Location on disk” information, you will need it in a moment

6. Connect to the terminal on one of the Bitbucket Data Center nodes

7. Navigate to the path obtained in step 5 above

8. Create a backup of this directory to a safe location

9. Still inside the directory from step 5, run a command like rm -r <ref>, where <ref> is the ref from the command output in step 3, for instance rm -r refs/pull-requests/1

10. Once you’ve repeated step 9 for all the refs identified in step 3, you can retry the clone operation with --mirror, which should now succeed.

Updated on May 19, 2025

Still need help?

The Atlassian Community is here for you.