A git 裸仓库 (详细信息在这里 https://stackoverflow.com/a/24115534/6309) 与文件模式无关。
裸存储库用作目标,进行推送。
您可以推送到裸存储库,因为它没有工作树:无需担心保持所述工作树与您刚刚推送的内容同步。
什么是“假”文件?什么构成“工作”目录?
不存在“假”文件。只是一个裸存储库仅包含 git 的管理和控制文件,而不包含您可以使用和修改的实际数据文件。
当存储库不是裸露的时候,它们会在“工作目录”中签出。
The git config手册页 http://git-scm.com/docs/git-config
core.fileMode
如果为 false,则忽略索引和工作树之间的可执行位差异;对于损坏的文件系统很有用,例如FAT(文件分配表) http://en.wikipedia.org/wiki/File_Allocation_Table.
See git-update-index http://git-scm.com/docs/git-update-index.html#_configuration.
指挥部荣誉core.filemode
配置变量。
如果您的存储库位于可执行位不可靠的文件系统上,则应将其设置为false
.
这会导致命令忽略索引中记录的文件模式和文件系统上的文件模式的差异(如果它们仅在可执行位上不同).
在这样一个不幸的文件系统上,您可能需要使用git update-index --chmod=
.
对我来说,它在每个仓库中./git/config
文件,靠近顶部,
我也是,但是在 Windows 上,它总是:
git config --local core.filemode
false
不要忘记 git 只记录两种文件模式:
With Git 2.37.3 (Q3 2022), "git fsck https://github.com/git/git/blob/363a193c3a2141f34808d70fdae8beac76076a53/Documentation/git-fsck.txt"(man https://git-scm.com/docs/git-fsck) is better at detecting invalid file modes.
在 2.37.3 之前,它从树对象读取模式,但在将模式传递给逻辑以检查对象健全性之前对其进行规范化,这在检查逻辑中隐藏了损坏的树对象。
这已得到纠正,但为了帮助退出无法追溯修复的损坏树对象的项目,此代码检测到的异常严重性目前已降级为“信息”。
See commit 4dd3b04 https://github.com/git/git/commit/4dd3b045f528b8d9cbbb4a50e371affb0543f37d, commit 53602a9 https://github.com/git/git/commit/53602a937dc9eacd67b6afcd781f7b15bb02682f, commit ec18b10 https://github.com/git/git/commit/ec18b10bf20574fc6d60c966412a11c81f9c17e0 (10 Aug 2022) by Jeff King (peff) https://github.com/peff.
(Merged by Junio C Hamano -- gitster -- https://github.com/gitster in commit 363a193 https://github.com/git/git/commit/363a193c3a2141f34808d70fdae8beac76076a53, 18 Aug 2022)
fsck https://github.com/git/git/commit/53602a937dc9eacd67b6afcd781f7b15bb02682f:实际上检测树中的错误文件模式
Reported-by: Xavier Morel
Signed-off-by: Jeff King
我们用的是普通的tree_desc
在 fsck 中迭代树的代码,这意味着我们只能看到它返回的规范化模式。
因此,我们永远不会看到任何意外的事情,因为它实际上会强制任何垃圾进入我们正常和接受的模式之一。
我们可以使用新的RAW_MODES
标记以查看真实模式,然后使用现有代码来实际分析它们。
现有代码是按照允许已知良好的方式编写的,因此测试各种损坏没有多大意义。
这里测试的应该是S_IFREG
但有无意义的权限。
Do note that the error-reporting here isn't great.
We don't mention the specific bad mode, but just that the tree has one or more broken modes.
But when you go to look at it with "git ls-tree https://github.com/git/git/blob/53602a937dc9eacd67b6afcd781f7b15bb02682f/Documentation/git-ls-tree.txt"(man https://git-scm.com/docs/git-ls-tree), we'll report the canonicalized mode!
This isn't ideal, but given that this should come up rarely, and that any number of other tree corruptions might force you into looking at the binary bytes via "cat-file", it's not the end of the world.
警告是:
warning in tree $tree: badFilemode: contains bad file modes