欢迎光临
我们一直在努力

error: unpack failed: error Missing tree

1.问题分析

详细报错内容:

error: unpack failed: error Missing tree

Cloning into 'client'…
remote: error: Could not read xxx
remote: fatal: bad tree object xxx
remote: aborting due to possible repository corruption on the remote side.
fatal: early EOF
fatal: index-pack failed
error: git upload-pack: git-pack-objects died with error.
fatal: git upload-pack: aborting due to possible repository corruption on the remote side.

error: unpack failed: error Missing tree xxx
fatal: Unpack error, check server log

多种原因可能导致此情况:

1.本地由于多次git commit导致一些commit ID生成,有可能没有把他们清除干净,所以本地的git对象和服务器上的git不一致,在push的时候产生冲突引起fail
2.新repo替换旧repo,但是旧repo没有关闭打开的补丁集,因此文件虽然消失,但仍然存在于数据库中
3.已经提交到了gitlab然后又使用git commit –amend来修改message

2.排查思路

1)可以到服务器对应git目录下

git fsck

#运行一些仓库的一致性检查, 如果有任何问题就会报告.

这项操作也有点耗时, 通常报的警告就是“悬空对象"(dangling objects).

git fsck可以得到更多错误信息,如果有HEAD为miss

2)查看该commit详情

git show ID

3.解决方法

1)到完整正常的git上对这个HEAD进行push

git push –no-thin omnigerrit HEAD:refs/for/分支

  • git push 默认是带-thin参数的(带过滤),push时会自动进行优化,将所发送的包大小降到最小。
  • 做法是发送时忽略本地仓库和远端仓库中共有的部分。
2)如果相关错误还没有得到修复,可以考虑浏览器过滤git-unpack-error-on-push-to-gerrit相关文章,有问题欢迎到评论区留言
赞(0)
未经允许不得转载:171主机测评 » error: unpack failed: error Missing tree
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址