Object directory does not exist - Git operations fail after upgrade or BITBUCKET_HOME update
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs 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
After upgrading Bitbucket Server to version 3.2+ (from a version prior to 3.2) or having moved BITBUCKET_HOME
to a different location, git operations (e.g. git push
) fail:
1
2
3
4
5
6
7
8
9
10
11
12
git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags origin branchname:branchname
POST git-receive-pack (700 bytes)
remote: error: object directory C:/Bitbucket ServerData/data/repositories/26/objects does not exist; check .git/objects/info/alternates. [K
remote: fatal: unresolved deltas left after unpacking [K
error: unpack failed: unpack-objects abnormal exit
Pushing to https://username@bitbucket.server/scm/projectkey/reponame.git
To https://username@bitbucket.server/scm/projectkey/reponame.git
! [remote rejected] branchname -> branchname (unpacker error)
error: failed to push some refs to 'https://username@bitbucket.server/scm/projectkey/reponame.git'
Completed with errors, see above."
You could also be getting the following screen upon browsing forks:

1
'/usr/bin/git cat-file -t refs/heads/master:' exited with code 128 saying: error: object directory /abdera/user0/atlass/application-data/bitbucket/data/repositories/292/objects does not exist; check .git/objects/info/alternates.
Cause
The forked repository (e.g. ID 292) of the upstream repository (e.g. ID 45) still refers to the old path in the alternates
file which Bitbucket Server uses to implement the fork functionality
This is tracked as BSERV-9625 - Bitbucket starts even if the git plugin fails to start.
In the past we saw this happening when the upgrade to a version higher than 3.2 (which included a data directory migration).
Another possible cause is described in BSERV-9761 - Repository alternates are not updated when BITBUCKET_HOME is symbolic link and its target changes.
Workaround
Stop Bitbucket Server.
Correct the path in the
alternates
file leaving therepoID
unchanged:For versions 3.2+
1
BITBUCKET_HOME/shared/data/repositories/<repoID>/objects/info/alternates
For versions prior to 3.2
1
BITBUCKET_HOME/data/repositories/<repoID>/objects/info/alternates
Start Bitbucket Server.
Was this helpful?