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?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Cyril CHAPON
  • 3,556
  • 4
  • 22
  • 40

2 Answers2

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

torek
  • 448,244
  • 59
  • 642
  • 775
  • 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 ? =/ – Cyril CHAPON May 22 '15 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 '15 at 18:07
  • Got it, thanks. Shame the way its designed but you answer my question – Cyril CHAPON May 22 '15 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) – Steve Benner May 29 '19 at 10:55
  • 2
    @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 '19 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

tst
  • 111
  • 1
  • 2