Git reset = fatal: unable to read tree

匿名 (未验证) 提交于 2019-12-03 02:24:01

问题:

Someone made a commit on the wrong branch so I tried to move the commit to another branch. When I tried to roll back the commit, I got this error:

[user@server gitrepo]$ git reset --hard 9c2de3c0 fatal: unable to read tree 9c2de3c0af09fc07a84ff84b594beb5a6d489181 

The object looks fine:

[user@server gitrepo]$ ls objects/9c/2de3c* -al -r--r--r-- 1 git git 222 Aug 28 12:09 objects/9c/2de3c0af09fc07a84ff84b594beb5a6d489181 

Why can't it read this object, and what do I do about that?

Edit: to distinguish my problem from others:

  • Git's database doesn't appear to be particularly out of sorts. Running git fsck -full shows only a few (~20) dangling blobs and one dangling commit. Which does not seem particularly alarming.

回答1:

I've got the same problem. Solved it by checking and fixing disk. Some files were corrupted.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!