Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bad sha1 files handling

Im getting these errors while doing git fsck --full --no-dangling on the remote repository. (GIT's server)

user@server:/var/git/REPOSITORY.git$ git fsck --full --no-dangling
bad sha1 file: ./objects/15/19d8eeacc8d0cd603bd87d2034508b1ffaffa8_28537991145d7e9d87b68335e9b82c2f788cb4fc
bad sha1 file: ./objects/32/4f425bcfe23d9f38b154427eeb9c800d109365_6df2d745fff22839759b25cc83f8d742c2e64086
bad sha1 file: ./objects/42/9225fd8d895084051189dc6478343d54fe41c8_28537991145d7e9d87b68335e9b82c2f788cb4fc
bad sha1 file: ./objects/46/798e4a01a5a7eaf2b203f6d1634d603497041b_6df2d745fff22839759b25cc83f8d742c2e64086
bad sha1 file: ./objects/bc/fb9d62ac05d5203249caa0e7e9cb5d1c32daba_6df2d745fff22839759b25cc83f8d742c2e64086
bad sha1 file: ./objects/cd/477947092b4f20feba8c37df974027b1864215_6df2d745fff22839759b25cc83f8d742c2e64086
Checking object directories: 100% (256/256), done.
Checking objects: 100% (136737/136737), done.
missing commit 590ebc3ac022491d7f11c483480fa9530adc91e8
missing tree bab1d768f0d4f6a02e0a30a6c446afaeabc4aa71

For every bad sha1 file there is another file that starts with the same name but doesnt have an underscore _ and then some other text. the files have the exact same file size but different date or time.

Example of the two files:

./objects/15/19d8eeacc8d0cd603bd87d2034508b1ffaffa8_28537991145d7e9d87b68335e9b82c2f788cb4fc
./objects/15/19d8eeacc8d0cd603bd87d2034508b1ffaffa8

I'm attaching screen shots of two cases out of the 6 because they are all the same:

Screenshot 1: File1

Screenshot 2: File 2 Can i delete the duplicates, what will happen?

*any ideas on the missing commit\tree?

like image 738
Mike Avatar asked Jan 14 '14 07:01

Mike


1 Answers

First since the issue is on the server, check if you don't have any clone which would not show the same issue: you could make a local bare repo clone out of that clone, and replace your "user@server:/var/git/REPOSITORY.git" with a copy of said bare repo.

Second, on the server:
Simply make a copy of user@server:/var/git/REPOSITORY.git in user@server:/var/git/REPOSITORY2.git, remove those '_' files and see if the error persists.
My guess is: the missing commit and tree will still be there.
That means you need to look for those in a clone in order to restore them, as I recommend in "How to diagnose and fix git fatal: unable to read tree".
See more at "How to fix corrupted git repository?".

like image 62
VonC Avatar answered Sep 21 '22 13:09

VonC