我有一个损坏的 git 对象。在 git objects 目录中,该文件的大小为 0。
首先进行 fsck:
git fsck --full
fatal: loose object a35c1489005cca1ffeb3c2d3e4d63988408b6a24 (stored in .git/objects/a3/5c1489005cca1ffeb3c2d3e4d63988408b6a24) is corrupted
然后是ls命令:
ls -l .git/objects/a3/5c1489005cca1ffeb3c2d3e4d63988408b6a24
----------+ 1 sampath ???????? 0 Sep 13 15:26 .git/objects/a3/5c1489005cca1ffeb3c2d3e4d63988408b6a24
该文件在磁盘上不存在!
# git cat-file -t a35c1489005cca1ffeb3c2d3e4d63988408b6a24
error: unable to find a35c1489005cca1ffeb3c2d3e4d63988408b6a24
fatal: git cat-file a35c1489005cca1ffeb3c2d3e4d63988408b6a24: bad file
我第一次遇到这个错误是在尝试拉取代码时。
我试过删除文件并尝试拉取,但是没有成功。它抱怨说文件不存在。
当我删除文件并运行fsck时,它显示了很多悬空对象。
# git fsck --full
broken link from commit 1e5980c224ff19b19ad99dbefed4c7c64c58aee6
to tree a35c1489005cca1ffeb3c2d3e4d63988408b6a24
dangling tree 0401d636a512b208dffd6ac6e153ab0a061f8d5d
dangling blob 58014c0266784a1e3cc1502de82837c5f36c8514
dangling tree 0507fa56260c693cea678eab0343240c5bba06ad
dangling tree 130770880c664a0b0cf5a21d037cbdba7480dc90
我尝试回退几个提交,但没有帮助。
有什么指示可以帮忙解决这个问题吗?