I have a git object that is corrupted. The size of the file is 0 in the git objects dir.
First a fsck:
git fsck --full
fatal: loose object a35c1489005cca1ffeb3c2d3e4d63988408b6a24 (stored in .git/objects/a3/5c1489005cca1ffeb3c2d3e4d63988408b6a24) is corrupted
Then a ls:
ls -l .git/objects/a3/5c1489005cca1ffeb3c2d3e4d63988408b6a24
----------+ 1 sampath ???????? 0 Sep 13 15:26 .git/objects/a3/5c1489005cca1ffeb3c2d3e4d63988408b6a24
That file doesn't exist on the disk!?
# git cat-file -t a35c1489005cca1ffeb3c2d3e4d63988408b6a24
error: unable to find a35c1489005cca1ffeb3c2d3e4d63988408b6a24
fatal: git cat-file a35c1489005cca1ffeb3c2d3e4d63988408b6a24: bad file
I saw this error first when I tried to do a pull.
I tried removing the file and doing a pull, but that did not work. It complained that the file is missing.
When I removed the file and ran fsck, it showed me a lot of dangling objects
# git fsck --full
broken link from commit 1e5980c224ff19b19ad99dbefed4c7c64c58aee6
to tree a35c1489005cca1ffeb3c2d3e4d63988408b6a24
dangling tree 0401d636a512b208dffd6ac6e153ab0a061f8d5d
dangling blob 58014c0266784a1e3cc1502de82837c5f36c8514
dangling tree 0507fa56260c693cea678eab0343240c5bba06ad
dangling tree 130770880c664a0b0cf5a21d037cbdba7480dc90
I tired going back a few commits and it did not help.
Any pointers on how to recover from this?