繁体   English   中英

克隆时网络驱动器上的 Git 存储库都显示相同的错误:“packfile 与索引不匹配”

[英]Git repositories on network drive all showing same error when cloned: "packfile does not match index"

我一直试图解决这个问题几个小时,我的运气为 0。 提前道歉,我对 Git 还是个新手。

我在网络驱动器(R:驱动器)上有大量 Git 存储库。 所有这些存储库都是另一个存储库的克隆,每个存储库都进行了不同的更改。

对于我的工作,我经常需要将 10 个以上的这些存储库克隆到我的本地机器(C:驱动器),所以我想我会制作一个批处理脚本来为我自动化这个过程。

当我运行我的批处理脚本(基本上只有 10+ git clone R:\\INSERT_REPO_HERE C:\\INSERT_DIRECTORY_HERE语句)时,这个过程需要几个小时,但这很正常,因为我与 R: 驱动器的连接很差。

问题:

我正在寻找加快克隆过程的方法,并找到了执行以下操作的建议:

git config --global pack.windowMemory "100m"
git config --global pack.SizeLimit "100m" 
git config --global pack.threads "1"
git config --global pack.window "0"
git config --global core.compression 0
git config --global core.bigfilethreshold 200K

所以,我在 R: 和 C: 驱动器上运行了这些命令。

现在,每当我从 R: 驱动器将任何repo 克隆到我的 C: 驱动器时,我都会收到以下错误:

Cloning into 'C:\Users\games\Documents\BitBucket\Adapt topics\BU11\BU11.3\src\course\en'...
done.
error: packfile C:/Users/games/Documents/BitBucket/Adapt topics/BU11/BU11.3/src/course/en/.git/objects/pack/pack-2105520c4dd562760badf1555e89a734a7dddfa3.pack does not match index
error: packfile C:/Users/games/Documents/BitBucket/Adapt topics/BU11/BU11.3/src/course/en/.git/objects/pack/pack-2105520c4dd562760badf1555e89a734a7dddfa3.pack does not match index
error: unable to read sha1 file of project/bower.json (15bb293aca56d25d07f9372c81d6d008b41f93cc)


error: packfile C:/Users/games/Documents/BitBucket/Adapt topics/BU11/BU11.3/src/course/en/.git/objects/pack/pack-2105520c4dd562760badf1555e89a734a7dddfa3.pack does not match index
error: packfile C:/Users/games/Documents/BitBucket/Adapt topics/BU11/BU11.3/src/course/en/.git/objects/pack/pack-2105520c4dd562760badf1555e89a734a7dddfa3.pack does not match index
error: unable to read sha1 file of project/js/project.js (02dbe8ec5a71541ce175fada7e0d405359124968)


fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'

我试过--unset设置我设置的全局配置,但它没有解决任何问题。 据我所知,R: 驱动器上的 repos 仍然包含我所有的文件,所以我没有丢失任何数据; 但我似乎无法找到解决此问题的方法,并且在 R: 驱动器上重新创建每个存储库也会花费我很长时间。

此外,运行git fsck --full会给出这个结果,无论我在哪个存储库上执行它:

Checking object directories: 100% (256/256), done.
error: packfile .git/objects/pack/pack-2105520c4dd562760badf1555e89a734a7dddfa3.pack does not match index
error: packfile .git/objects/pack/pack-2105520c4dd562760badf1555e89a734a7dddfa3.pack cannot be accessed
error: packfile .git/objects/pack/pack-2105520c4dd562760badf1555e89a734a7dddfa3.pack does not match index
error: packfile .git/objects/pack/pack-2105520c4dd562760badf1555e89a734a7dddfa3.pack does not match index
error: packfile .git/objects/pack/pack-2105520c4dd562760badf1555e89a734a7dddfa3.pack does not match index
error: packfile .git/objects/pack/pack-2105520c4dd562760badf1555e89a734a7dddfa3.pack does not match index
Checking connectivity: 369, done.
error: packfile .git/objects/pack/pack-2105520c4dd562760badf1555e89a734a7dddfa3.pack does not match index
error: packfile .git/objects/pack/pack-2105520c4dd562760badf1555e89a734a7dddfa3.pack does not match index
error: packfile .git/objects/pack/pack-2105520c4dd562760badf1555e89a734a7dddfa3.pack does not match index
broken link from    tree fc7405e6041f547e5845cead57f06a38ed4b814f
              to    blob db3d21c232d266d476e028af6fe640b5447dba14

我什至不完全确定什么是“打包文件”。 请,任何帮助将不胜感激!

编辑:我不知道这是否有帮助,但查看 R: 驱动器中每个存储库的.git/objects/pack文件夹显示 .pack 文件最后一次修改是在我运行git config命令的同一天:

包上次修改

切勿将 Git 存储库存储在联网或云同步的驱动器上。

什么,“从不”? 1

是的,真的,从来没有 为什么不? 因为像你看到的那样的问题发生。 只是不要这样做。


1强制性链接

虽然不是我原来帖子的答案,但我找到了一种适合我的具体情况的解决方法。 基本上,我只是重新创建了每个存储库。

我进入每个存储库并删除“.git”文件,然后运行

git init
git add .
git commit -m 'PackFix'

这确实意味着我现在已经丢失了这些存储库的所有 Git 提交历史记录,但幸运的是(对于我的特定情况),这不是一个大问题。

对于将来读到这篇文章的任何人,我想说这个帖子更像是一个关于在网络驱动器上运行--global命令的警告(特别是如果你不完全理解他们会做什么的话)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM