Forks cannot be synchronized in Bitbucket Datacenter due to "refs does not point to a valid object" error
プラットフォームについて: Data Center のみ - この記事は、Data Center プラットフォームのアトラシアン製品にのみ適用されます。
この KB は Data Center バージョンの製品用に作成されています。Data Center 固有ではない機能の Data Center KB は、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。
*Fisheye および Crucible は除く
問題
During the automatic fork synchronization, the following appears in the atlassian-bitbucket.log:
WARN [ref-sync:thread-1] c.a.s.i.r.s.a.AutoRefSyncProcessor <fork project>/<fork repository>[<fork repository_id>]: Could not synchronize changes with <source project>/<source repository>[<source repository_id>]
com.atlassian.bitbucket.scm.CommandFailedException: '/usr/bin/git -c gc.auto=0 fetch --no-tags ../<source repository_id> refs/heads/feature/branch1:refs/heads/feature/branch1' exited with code 0 saying: error: refs/heads/feature/invalid_branch1 does not point to a valid object!
error: refs/heads/feature/invalid_branch1 does not point to a valid object!
error: refs/heads/feature/invalid_branch2 does not point to a valid object!
error: refs/heads/feature/invalid_branch3 does not point to a valid object!
診断
Diagnostic Steps
Run "git fsck"
command on the repository. The utility will report a "invalid sha1 pointer"
error for each line mentioned above.
原因
A git gc
has been run on the source repository, which removed the references to the branches just from the source repository.
Never run git gc
directly on a repository, here are more details on why that's the case: How to perform manual garbage collection on a repository in Bitbucket Server.
ソリューション
Delete the forked repository and create the fork again.