Pushing to Bitbucket Server reports there are too many unreachable loose objects
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
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.
*Fisheye および Crucible は除く
問題
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).
- Running
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
<BITBUCKET_HOME>/shared/data/repositories/<repository_id>
に移動します。Delete the
gc.log
file.git config --bool gc.autodetach false
を実行します。
ソリューション
Upgrade to Bitbucket Server 5.0+ which provides enhancements to how Bitbucket Server handles garbage collection internally.