1) 问题描述
我有几个包文件说unknown object type 0 at offset
,与网络上 99% 的帖子不同,这不是本地问题,而是出现在远程和克隆的 repos 中。
2)我想做什么
我如何简单地删除那些无效的引用,这样我就不会被阻止在 repo 上执行其他操作?最终,我想运行一个git filter-branch --subdirectory
命令将我的 9.2G 存储库拆分为子模块,但它会阻塞这些无效的包文件(注意:index-filter 有效)。
3) 完整的错误信息
$ git filter-branch --subdirectory-filter mydir HEAD
error: unknown object type 0 at offset 78171701 in /media/me/unmirrored/trash/git_filter_subdir_attempt.2020-06-21/me.git.cloned/.git/objects/pack/pack-35b37571b163f30d71a98002a7f6a30aaeeadbad.pack
fatal: packed object a30f803926d5e369b0bda4982dba89fa7127cabe (stored in /media/me/unmirrored/trash/git_filter_subdir_attempt.2020-06-21/me.git.cloned/.git/objects/pack/pack-35b37571b163f30d71a98002a7f6a30aaeeadbad.pack) is corrupt
Could not get the commits
我也把git fsck --full
输出放在这里:https ://pastebin.com/WCnArrCh
4)我试过的
再取
大多数解决方案都假定您有一个未损坏的远程副本。但我所有的副本都已损坏。
删除参考
(我会在复制后添加不成功的结果响应)
git update-ref -d abc123
(https://git.wiki.kernel.org/index.php/GitFaq#salvage)
git 修复
(我会在复制后添加不成功的结果响应)
git-repair
git-repair --force
(http://manpages.ubuntu.com/manpages/bionic/man1/git-repair.1.html)