Git ignoring gitconfig?
It appears Git is ignoring
$ git config --global core.filemode false $ git config -l core.filemode=false core.filemode=true
So now there are 2 entries for
core.filemode and git is still not ignoring filemode changes
- What settings affect user name in Git?
- how to implicitly `git push` from a local branch “X” to “origin/Y”
- what's the difference between `` and `` in a gitconfig file?
- gitconfig aliasing using !source doesn't work (zsh)
- Best practices for cross platform git config?
- Git Graphical log is not working
$ touch modetest $ git add . $ git commit -m test1 [master (root-commit) 320cfe4] test1 0 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 modetest $ chmod +x modetest $ git diff diff --git a/modetest b/modetest old mode 100644 new mode 100755
Based on torek’s answer, I added this line to my
[ -d .git ] && git config core.filemode false
3 Solutions collect form web for “Git ignoring gitconfig?”
Maybe a bit overkill, but in Cygwin this bothered me enough to dig into the issue more. When git is built from source code, it checks the file system it’s built on to see if it understands executable bits.
I went ahead and built git from source on my Cygwin system and installed it to a local directory, then added the binary to my path. The basic steps are:
cd ~/ mkdir git cd git mkdir inst git clone -c core.autocrlf=false https://github.com/git/git.git cd git NO_TRUSTABLE_FILEMODE=1 make prefix=/home/[username]/git/inst/ NO_TRUSTABLE_FILEMODE=1 make prefix=/home/[username]/git/inst/ install
Then add something like this to .bashrc:
Of course, that build won’t work unless you have all the build dependencies installed in Cygwin. With a little poking around I was able to do it without too much trouble. Now git init and git clone on that system defaults filemode to false. The trick is defining NO_TRUSTABLE_FILEMODE for the build.
When creating or reinitializing a new repo,
git init always sets a new value
core.filemode based on the result of probing the file system. You’ll just
have to manually:
git config core.filemode false
git config --unset core.filemode
to make it respect the one in your
~/.gitconfig. If you run
git init again
the per-repo setting will go back to
true on your system.
(EDIT) so to resume, on windows we need to do :
git config --global --unset core.filemode git config --unset core.filemode git config core.filemode false
And you can create an empty config file in Git install dir for new git folders (init) :
C:\bin\Git\share\git-core\templates>echo > config C:\bin\Git\share\git-core\templates>notepad config
And put inside :
[core] filemode = false