复制:
$ git config --system receive.fsckObjects true
$ git clone [email protected]:jashkenas/underscore.git # or `git submodule add -- [email protected]:jashkenas/underscore.git`
Cloning into 'underscore'...
remote: Enumerating objects: 215, done.
remote: Counting objects: 100% (215/215), done.
remote: Compressing objects: 100% (130/130), done.
error: object b252cd0cf660db8fea1a40ae7d3ba0e34a41ffd3: zeroPaddedFilemode: contains zero-padded file modes
fatal: fsck error in packed object
@zackschuster感谢您与我们联系。
我不得不在网上寻找更多信息,因为以前我从未听说过git fsck或此特定错误。 我最终在https://github.com/pallets/flask/issues/2029中找到了针对此类问题的两种可能的解决方案。 第一个通过重建存储库确实解决了该问题,但是它具有破坏性,因为有缺陷的对象之后的所有哈希都将发生变化。 第二种方法是添加一些文档,以警告人们有关此问题的信息,并指导他们如何解决此问题(这似乎是完全可行的)。 只有后一种解决方案才适用于此回购协议。
但是,所有这些对我来说似乎都没有意义,因为我无法重现该错误。 我尝试使用Git 2.26.2从开头的帖子中运行确切的命令,除了在第一个命令前面加上sudo
,因为这是更改系统范围设置所必需的。 仓库刚刚克隆而没有任何错误。 我也找不到带有b252cd0cf660db8fea1a40ae7d3ba0e34a41ffd3哈希的任何对象。
@zackschuster请仔细检查您遇到的问题不是由于网络传输错误,磁盘读取错误或某些特定版本的Git错误引起的。 我现在将解决此问题; 如果您找到我可以执行的所有步骤以便最终重现该错误,或者如果其他人可以确认这确实是Underscore存储库中的问题,那么我们当然会重新打开它。
@jgonggrijp我在macOS上使用git 2.29.2,使用autoconf和make的标准方式进行编译。 对控制台命令中的错误表示歉意; 确实,我已经从$HOME/.gitconfig
设置了receive.fsckObjects。
我不确定如何最终跟踪blob错误,但我将尝试获取更多详细信息:smile:
@jgonggrijp我找到了一些信息。 注意:
git clone --config transfer.fsckobjects=false [email protected]:jashkenas/underscore.git
可以避免该错误(请注意transfer.fsckobjects
;我在原始报告中的设置有误。抱歉!)git fsck
(使用v2.29.2
)会显示两个zeroPaddedFilemode错误git cat-file -p
显示文件列表,表明它们是错误的提交; git cat-file -t
它们标记为tree
。 git show
输出是git cat-file -p
信息较少的版本。 git log
返回任何内容。我已包含控制台输出以供参考:
~/Source
$ git clone --config transfer.fsckobjects=false [email protected]:jashkenas/underscore.git
Cloning into 'underscore'...
remote: Enumerating objects: 215, done.
remote: Counting objects: 100% (215/215), done.
remote: Compressing objects: 100% (130/130), done.
remote: Total 10434 (delta 185), reused 101 (delta 85), pack-reused 10219
Receiving objects: 100% (10434/10434), 5.61 MiB | 9.21 MiB/s, done.
Resolving deltas: 100% (6770/6770), done.
~/Source
$ cd underscore
~/Source/underscore
$ git fsck
Checking object directories: 100% (256/256), done.
warning in tree b252cd0cf660db8fea1a40ae7d3ba0e34a41ffd3: zeroPaddedFilemode: contains zero-padded file modes
warning in tree 8a654ec549a230dcab28e54c6e53c460cb9e190d: zeroPaddedFilemode: contains zero-padded file modes
Checking objects: 100% (10434/10434), done.
~/Source/underscore
$ git cat-file -p b252cd0cf660db8fea1a40ae7d3ba0e34a41ffd3
100644 blob d8cef485ec7309b938b4c3bc19171458e9139811 LICENSE
100644 blob 333b13f45b62427fd0840c77bb55bfc8fb96be6b README
100644 blob 721c294b3ddb1d3e6ed35a7d9336e162aab01bb9 Rakefile
100644 blob bdaef73ca2ca82b90d37cec4b9c38606b440d619 index.html
100644 blob 6771de07ecd088853df1376f3693e81584ec2560 package.json
040000 tree d0a277f748b309f3d26e13d1cb5133ff003c468d test
100644 blob 7cfbf993705f83e7fde17e9745b4187f7a4047b2 underscore-min.js
100644 blob 625411233e487b5cd8da1a32a69e5693b1862c09 underscore.js
~/Source/underscore
$ git cat-file -p 8a654ec549a230dcab28e54c6e53c460cb9e190d
100644 blob 9644b34c3f5c16753d1061497aa7aab426e6c896 LICENSE
100644 blob e41015cd7cc04a940ac4e7a451aeb0b0b384c3a3 README
100644 blob 6af14bb6d570698990d30aa0b46e398ae3fd48b1 Rakefile
100644 blob 1a03be19fc8ddf61b113f71c19d6892fb74ff4f5 index.html
100644 blob 2cbc8128d9db1feabc44a3be14c504e40b6b7e2e package.json
040000 tree fae9dcb01827d13b2b5fbd9afab07489b249dab8 test
100644 blob 2c8b499882c2a5d662ea35c80ec7ea0fa111814f underscore-min.js
100644 blob 42bf31a27545d0d5460c655d13ce9bbf76e540b3 underscore.js
~/Source/underscore
$ git cat-file -t b252cd0cf660db8fea1a40ae7d3ba0e34a41ffd3
tree
~/Source/underscore
$ git cat-file -t 8a654ec549a230dcab28e54c6e53c460cb9e190d
tree
~/Source/underscore
$ git show b252cd0cf660db8fea1a40ae7d3ba0e34a41ffd3
tree b252cd0cf660db8fea1a40ae7d3ba0e34a41ffd3
LICENSE
README
Rakefile
index.html
package.json
test/
underscore-min.js
underscore.js
~/Source/underscore
$ git show 8a654ec549a230dcab28e54c6e53c460cb9e190d
tree 8a654ec549a230dcab28e54c6e53c460cb9e190d
LICENSE
README
Rakefile
index.html
package.json
test/
underscore-min.js
underscore.js
~/Source/underscore
$ git log b252cd0cf660db8fea1a40ae7d3ba0e34a41ffd3
~/Source/underscore
$ git log 8a654ec549a230dcab28e54c6e53c460cb9e190d
~/Source/underscore
$
我现在可以重现该问题。 感谢您的坚持,@ zackschuster。
因此,我们可能应该仅记录存在此问题的事实并解释人们如何解决该问题。 也许CLONING.md
是此类文档的合适位置。
或者,也许我们可以以某种方式找出引用该树的提交。 如果我们很幸运,它可能只在一些不重要的分支中可以删除(或重建)。 我们可能应该先尝试一下。
欢迎帮忙。