Pushing to Bitbucket Server reports there are too many unreachable loose objects

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

When pushing to Bitbucket Server, the following message is written in Command Prompt / Terminal:

$ git push -f
Counting objects: 10, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (10/10), done.
Writing objects: 100% (10/10), 838 bytes | 0 bytes/s, done.
Total 10 (delta 7), reused 0 (delta 0)
remote:
remote: View pull request for package-generation => develop:
remote: https://mybitbucketinstance/projects/PROJ/repos/my-repo/pull-requests/261
remote:
error: The last gc run reported the following. Please correct the root cause
and remove gc.log.
Automatic cleanup will not be performed until the file is removed.
warning: There are too many unreachable loose objects; run 'git prune' to remove them.
To ssh://git@mybitbucketinstance/proj/my-repo.git
+ 71f8fbd...954cbcb package-generation -> package-generation (forced update)

Diagnosis

  • The error is prefixed by "remote" indicating that the error was generated by the remote (i.e., by Bitbucket Server).
  • Running git prune (as suggested in the error message) does not help.

Cause

Garbage collection is being triggered when the client attempts to push to the server and this is failing due to the existence of the gc.log file; daemonized git gc now saves output to gc.log. Hence, subsequent executions of gc --auto will not run.

The push does succeed and does not prevent developers from working as normal.

Workaround

  1. Determine the ID of the repository into which changes are being pushed

  2. Go to <BITBUCKET_HOME>/shared/data/repositories/<repository_id>
  3. Delete the gc.log file.
  4. Run git config --bool gc.autodetach false

Resolution

Upgrade to Bitbucket Server 5.0+ which provides enhancements to how Bitbucket Server handles garbage collection internally.

Last modified on Nov 2, 2018

Was this helpful?

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