I can't find any documentation describing exactly what git configuration files are being checked a git config --get-all command
is run. Here's my output when I run it for core.autocrlf.
git config --get-all core.autocrlf
false
true
true
I'm having some phantom line feed issues and I was wondering if anybody can tell me where that first "false" is coming. I've read that git is supposed to use the last one, and "true" is the setting I want. But I'm not sure if it's always using that in every scenario. Like if I'm using alternative git UI's through eclipse git or through the git GUI applications or something.
I think two places that it's being read from is
REPO_DIR/.git/config
and
WINDOWS_USER_DIR/.gitconfig
But where's this 3rd config setting coming from?
Git will check these files in the given order:
$(prefix)/etc/gitconfig
$XDG_CONFIG_HOME/git/config
or $HOME/.config/git/config
~/.gitconfig
$GIT_DIR/config
So the third value likely comes from the system-wide configuration file in /etc/gitconfig
.
See the git-config man page for further details.
You're right in that Git reads the config from the repo .git/config
and the user home directory .gitconfig
You probably have that config duplicated in one of those files, you can manually edit them and check for yourself. Here's a simple test I made on my machine
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[branch "master"]
remote = origin
merge = refs/heads/master
[core]
bare = false
[root@test .git]# git config --get-all core.bare
false
false
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[branch "master"]
remote = origin
merge = refs/heads/master
[root@test .git]# git config --get-all core.bare
false
Put Simply , from to bottom , first is shows value of System level configuration for Git , then global level configuration and at last it is local level configuration.
If the configuration variable in a particular level of file have many values , then all those values are shown too in the order they are mentioned in that particular config file.