I struggled with some line-ending problems about 20 commits back and some weird things happened. Now git fsck shows:
Checking object directories 100% (256/256), done.
error in tree ee2060e71cb36d33be5ddc1fe9ca8d7dd0ab35cd: contains duplicate file entries
Checking objects: 100% (8633/8633), done.
and git show ee2060 shows:
File1.cs
File2.cs
File2.cs
File2.cs
File3.cs
This is preventing me from pushing to my remote. git push shows:
error: unpack failed: index-pack abnormal exit
To https://github.com/username/Project.git
! [remote rejected] master -> master (n/a (unpacker error))
error: failed to push some refs to 'https://github.com/username/Project.git'
I have tried repacking and garbage collecting. How can I resolve this problem?
I finally fixed the repo by doing the following
painstakingly check out commits from the bad repo into the working copy of the new clone
git checkout fe3254FIRSTCOMMITAFTERORIGIN/MASTER/HEAD . // note the dot at the end
// without the dot, you move your head to the commit instead of the commit
// to the working copy, and seems to bring the corrupt object into your good clone
garbage collect + prune
git gc --aggressive --prune=now
I had a problem of this ilk and all the solutions here and in other SO threads failed to fix it for me. In the end I used BFG repo cleaner to destroy all the commits which references the bad folder name, which was probably overkill but successfully repaired the repo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With