Git global core.fileMode false overridden locally on clone
Asked Answered
R

2

16

Reading this, I was able to configure both globally and locally my fileMode config to false.

However, when I git clone, git keeps initializing the projects with local config forced to fileMode true, so that it overrides my global false. As a consequence I have, for every project, to either remove the local config or set it to false manually, which entirely lose the point of having a global config.

How can I prevent git from setting, by default, on every project, this config locally? Is that driven by another config variable? By the server?

Rintoul answered 22/5, 2015 at 8:51 Comment(0)
A
13

Clone, like init, always sets a local core.filemode when it creates a new repository. See my answer to this question for details. The only way to clobber the local setting after a clone is to do it manually (e.g., by having a wrapper command that does the clone, then goes into the clone and removes the setting). Or, as in tst's answer and Steve Benner's comment, add -c core.filemode=false to your git clone (be sure to put the -c option after the verb clone).

Antifriction answered 22/5, 2015 at 10:57 Comment(5)
Hey =) Thanks for your answer. "Clone, like init, always sets a local core.filemode when it creates a new repository". And there is realy no way at all to configure the fact that it sets that fileMode ? =/Rintoul
@CyrilCHAPON: there is a build-time option (again, see other answer), so you could tweak your build. The option makes this a little easier than just modifying the source, but not a lot easier. :-)Antifriction
Got it, thanks. Shame the way its designed but you answer my questionRintoul
I'm also sad and confused as to why git init overrides the global setting... An example of a 'wrapper command' would be a Bash function like ginit() { git init --config core.filemode=false; } or a shell alias, such as alias ginit="git init --config core.filemode=false" (I would not recommend overriding the original command itself with an alias)Gunnery
@SteveBenner: the why is that the core developers of Git intended (and presumably still intend) core.fileMode to reflect a property of the file system itself, rather than a user-chosen setting. I'm not at all sure I agree with the core developers, but that would be why they did it.Antifriction
R
11
git clone --config core.filemode=false YOUR_REPOSITORY

for further information refer to the usage information of git clone, or just enter:

git clone

without any arguments

Ryley answered 25/2, 2016 at 14:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.