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?

2 Answers 2

12

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).

5
  • 1
    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 ? =/ May 22, 2015 at 12:56
  • 1
    @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. :-)
    – torek
    May 22, 2015 at 18:07
  • Got it, thanks. Shame the way its designed but you answer my question May 22, 2015 at 20:24
  • 1
    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) May 29, 2019 at 10:55
  • 1
    @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.
    – torek
    May 29, 2019 at 16:22
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.