什么是 git 的“文件模式”?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19620335/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is git's "filemode"?
提问by Alex Gray
For something that exists in EVERY single git
repo... on earth... there sure isn't very much info out there regarding filemode
. The first 100 responses from google were all over the place, and a question with this' title handn't been asked.. so here goes.. What is filemode
? For me, it's in every repo's ./git/config
file, near the top, a lá...
对于存在于每个单一git
仓库中的东西......在地球上......肯定没有太多关于filemode
. 来自 google 的前 100 个回复到处都是,没有人问过这个标题的问题..所以这里是..什么filemode
?对我来说,它在每个 repo 的./git/config
文件中,靠近顶部,一个 lá...
[core]
filemode = true
What is it? What does it mean? Does it bear any relation to
它是什么?这是什么意思?是否与
bare = false
which I also don't really get... I use git
like a madman, and know what a million otherof git's endless, and IMHO, arbitrarily concocted / half-brainedconfig
parameters do.. but not this one... I'm sure it's a simple thing (maybe related to permissions? or war triggers a change flag?), so if you know more about how to manipulate the setting / and to what effect.. that would be good to know...
我也没有真正明白......我git
像疯子一样使用,并且知道git 无穷无尽的其他一百万个,恕我直言,任意炮制/半脑config
参数的作用......但不是这个......我是确定这是一件简单的事情(可能与权限有关?或War会触发更改标志?),所以如果您了解更多有关如何操作设置/以及产生什么效果的信息......那会很高兴知道......
回答by VonC
A git bare repo (detailed here) has no relation with filemode.
It is used for pushing to it, because since it has no working tree, there is no concern about maintaining said working tree in sync with what you just pushed.
一个 git 裸仓库(这里有详细说明)与文件模式没有关系。
它用于推送到它,因为它没有工作树,因此不必担心保持所述工作树与您刚刚推送的内容同步。
what is a "fake" file? and what constitutes a "working" directory?
什么是“假”文件?什么构成“工作”目录?
There is no "fake" file. It is just that a bare repo only contains git's administrative and control files, not actual data file you could work with and modify.
Those are checked out in a "working directory", when the repo is not bare.
没有“假”文件。只是一个裸仓库只包含 git 的管理和控制文件,而不是您可以使用和修改的实际数据文件。
当 repo 不是空的时,它们会在“工作目录”中检出。
core.fileMode
If false, the executable bit differences between the index and the working tree are ignored; useful on broken filesystems like FAT (File Allocation Table).
Seegit-update-index
.The command honors
core.filemode
configuration variable.
If your repository is on a filesystem whose executable bits are unreliable, this should be set tofalse
.
This causes the command to ignore differences in file modes recorded in the index and the file mode on the filesystem if they differ only on executable bit.
On such an unfortunate filesystem, you may need to usegit update-index --chmod=
.For me, it's in every repo's
./git/config
file, near the top,
如果为 false,则忽略索引和工作树之间的可执行位差异;在损坏的文件系统上很有用,比如FAT(文件分配表)。
见git-update-index
。该命令遵循
core.filemode
配置变量。
如果您的存储库位于可执行位不可靠的文件系统上,则应将其设置为false
.
这会导致命令忽略索引中记录的文件模式和文件系统上的文件模式之间的差异(如果它们仅在可执行位上有所不同)。
在这样一个不幸的文件系统上,您可能需要使用git update-index --chmod=
.对我来说,它在每个 repo 的
./git/config
文件中,靠近顶部,
Me too, but on Windows, it is always:
我也是,但在 Windows 上,它总是:
git config --local core.filemode
false
Don't forget that git only records two filemodes:
不要忘记 git 只记录两种文件模式:
- 644
- 755
- 644
- 755
回答by cforbish
filemode
set true means file mode permission changes are considered changes.
filemode
set true 表示文件模式权限更改被视为更改。
bare
set true means the directory is not a working directory (no real files).
bare
set true 表示该目录不是工作目录(没有实际文件)。