Forks cannot be synchronized in Bitbucket Datacenter due to "refs does not point to a valid object" error

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

Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles 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

Problem

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!

Diagnosis

Diagnostic Steps

Run "git fsck" command on the repository. The utility will report a "invalid sha1 pointer" error for each line mentioned above.

Cause

A git gc has been run on the source repository, which removed the references to the branches just from the source repository.

(warning) 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.

Resolution

Delete the forked repository and create the fork again. 

Description
Forks cannot be synchronized due to "AutoRefSyncProcessor could not synchronize changes with" due to "refs does not point to a valid object"
ProductBitbucket

Last modified on Mar 13, 2024

Was this helpful?

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