Git fatal object corrupted but easily fixed
Quick follow-up to conversation with @matthewmccull:
No joy w/git. Noticed this last week:
fatal: object 25bc05c557a210071a5154a64af216e6ed7d6a09 is corrupted
Looking a little closer today. I'm not the first to deal w/this. Stack Overflow rocks! (So does Google, but they don't need any more kudos. :)
Of course Linus has the best advice.
$ ls -l ~/.git/objects/25/bc05c557a210071a5154a64af216e6ed7d6a09
-r--r--r-- 1 tbc tbc 0 Dec 6 18:47 /home/tbc/.git/objects/25/bc05c557a210071a5154a64af216e6ed7d6a09
$
Aha. So ok to remove since it's empty, anyway.
$ rm ~/.git/objects/25/bc05c557a210071a5154a64af216e6ed7d6a09
$ cd;git fsck --full
[Dangling commits uninteresting.]
dangling tree cf2353ddcfeb7f0d302d07070ada2296ae006173
dangling tree 0827de28e9205f0876b761704125fba497548cf8
$
Fascinating. 'git ls-tree' shows no missing blobs. So all should be well.
$ cd;git gc
error: refs/heads/master does not point to a valid object!
warning: reflog of 'refs/heads/master' references pruned commits
warning: reflog of 'HEAD' references pruned commits
Counting objects: 4830, done.
Compressing objects: 100% (4582/4582), done.
Writing objects: 100% (4830/4830), done.
Total 4830 (delta 1578), reused 0 (delta 0)
$
Yup. And my confidence in git is restored!
[Update: I'm not done. I still need to fix that error. Stay tuned.]