Pushing to Bitbucket Server reports there are too many unreachable loose objects
Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.
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)
- The error is prefixed by "remote" indicating that the error was generated by the remote (i.e., by Bitbucket Server).
git prune(as suggested in the error message) does not help.
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.
Determine the ID of the repository into which changes are being pushed
- Go to
git config --bool gc.autodetach false
Upgrade to Bitbucket Server 5.0+ which provides enhancements to how Bitbucket Server handles garbage collection internally.