Repository has invalid reflog entry
Problem
When you run git fsck
in a repository on Bitbucket Server's local disk, you see the following error messages:
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.
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:
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}:
Last modified on Jul 15, 2019
Powered by Confluence and Scroll Viewport.