Repository has invalid reflog entry
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
When you run git fsck
in a repository on Bitbucket Server's local disk, you see the following error messages:
1
2
3
4
2019/03/16 01:19:47 error: stash-refs/pull-requests/36592/merge: invalid reflog entry 1a0d6e42a61f0f0e74aaebd2064de77281548f58
2019/03/16 01:19:47 error: stash-refs/pull-requests/36592/merge: invalid reflog entry 1a0d6e42a61f0f0e74aaebd2064de77281548f58
2019/03/16 01:19:47 error: stash-refs/pull-requests/37256/merge: invalid reflog entry 0e7b0701bcdf5f07477a1b745be4d720911d03a9
2019/03/16 01:19:47 error: stash-refs/pull-requests/37256/merge: invalid reflog entry 0e7b0701bcdf5f07477a1b745be4d720911d03a9
Cause
There are broken commits in the reflogs related to pull requests.
Resolution
Find a Bitbucket repository ID in the UI of Bitbucket by going to the repository and then settings. There you'll see a line that says "Location on disk" and a path similar to this: BITBUCKET_HOME/shared/data/repositories/1.
Use the following command in the repository directory to fix it.
1
git reflog expire --expire=never --expire-unreachable=never --rewrite --stale-fix -- stash-refs/pull-requests/36592/merge stash-refs/pull-requests/37256/merge
This command should have only removed broken entries from the reflogs. You should get output similar to the following:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
3f2a0eb9a615b stash-refs/pull-requests/36592/merge@{0}:
ceed87100bcad stash-refs/pull-requests/36592/merge@{1}:
63f396d7791e0 stash-refs/pull-requests/36592/merge@{2}:
19018165f625a stash-refs/pull-requests/36592/merge@{3}:
78b6e69dd2c57 stash-refs/pull-requests/36592/merge@{4}:
ac9a87dd9ffe9 stash-refs/pull-requests/36592/merge@{5}:
f38c484f92609 stash-refs/pull-requests/36592/merge@{6}:
6e4db288a1936 stash-refs/pull-requests/36592/merge@{7}:
763b87c4e51ae stash-refs/pull-requests/36592/merge@{8}:
89fdc03de0d85 stash-refs/pull-requests/36592/merge@{9}:
13d4b4b358891 stash-refs/pull-requests/36592/merge@{10}:
60177ffa1d20f stash-refs/pull-requests/36592/merge@{11}:
f671c99122af1 stash-refs/pull-requests/36592/merge@{12}:
c4a9463f60806 stash-refs/pull-requests/36592/merge@{13}:
75a837a9d08ee stash-refs/pull-requests/36592/merge@{14}:
Was this helpful?