【问题标题】:Git reset = fatal: unable to read treeGit重置=致命:无法读取树
【发布时间】:2013-09-02 03:10:23
【问题描述】:

有人在错误的分支上提交,所以我尝试move the commit to another branch。当我试图回滚提交时,我收到了这个错误:

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

对象看起来不错:

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

为什么它不能读取这个对象,我该怎么办?

编辑:将我的问题与其他问题区分开来:

  • Git 的数据库似乎 并没有特别不合时宜。运行 git fsck -full 仅显示几个(~20)悬空 blob 和一个悬空提交。哪个does not seem particularly alarming

【问题讨论】:

  • @Gabriele:我看过那个帖子,但是那个问题,它的答案,属于broken link from commit。我运行git fsck时没有这样的错误。
  • 1) git cat-file -t 9c2de3c0 显示什么? 2) git cat-file -p 9c2de3c0 显示什么? (我怀疑至少有一个也会失败,但值得一试)
  • @torek - 1) git cat-file -t 9c2de3c0 = 'commit' 2) git cat-file -p 9c2de3c0 = 我的消息,'模块:添加了相似的术语(MM)'
  • 嗯,“树”和“父母”部分(在-p 输出中)呢?如果您遵循这些 ID,它们会起作用吗?

标签: git


【解决方案1】:

我也遇到了同样的问题。通过检查和修复磁盘解决了它。部分文件已损坏。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-10-22
    • 2012-11-10
    • 1970-01-01
    • 2015-01-25
    • 2015-01-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多