代码之家  ›  专栏  ›  技术社区  ›  Sridhar Sarnobat

偏移量处的未知对象类型0-所有存储镜像已损坏,阻止筛选器分支子目录筛选器

  •  0
  • Sridhar Sarnobat  · 技术社区  · 5 年前

    1) 问题描述

    我有几份文件说 unknown object type 0 at offset

    2) 我想做什么

    如何简单地删除那些无效的引用,这样就不会阻止我对回购进行其他操作?最终,我想运行一个 git filter-branch --subdirectory 命令将我的9.2G repo拆分为子模块,但它阻塞了这些无效的包文件(注意:索引过滤器起作用)。

    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 )

    0 回复  |  直到 5 年前
        1
  •  1
  •   britodfbr    5 年前

    哦。。多次尝试。。 我们可以试试这个:

    第一次尝试:

    重新创建索引:

    git co -f HEAD
    rm .git/index
    git reset
    

    检查并修复Git文件系统

    git fsck --full --no-dangling 
    

    第二次尝试:

    1. 创建新的恢复分支; git branch commit0 1e89694;
    2. git push --all
    3. cd /tmp; git clone --depth 1 git@git.tool.com:youproject/project.git -b commit0
    4. 带着问题进入工作指导。
    5. 删除目录.git
    6. 将所有内容复制到workdirectory recovery; rsync -vaRCHz . /tmp/project
    7. git add .; git ci -m "Recover $(date)"; git push --all; git merge --ff master

    组织分解结构:

    如果您在git存储库中有非常多的二进制文件,可能还需要其他配置。 https://stackoverflow.com/a/541490/5132101 , https://opensource.com/life/16/8/how-manage-binary-blobs-git-part-7 或Git大文件存储(LFS)[https://git-lfs.github.com/]

    推荐文章