Git on Windows: Whence Cometh Configuration
I recently went through the process of setting up a new development environment on Windows which included installing Git
It turns out, since the last time I installed git on Windows, a change was made for the purposes of sharing git configuration across different git projects (namely, libgit2 and Git for Windows) where a Windows-specific location is now used as the lowest setting precedence (i.e. the default settings). This is the file: C:\ProgramData\Git\config. It doesn’t appear git added a way to list or edit this file as a well-known location (e.g. ‘git config –list windows’), so it’s not particularly discoverable aside from knowing about the ‘–show-origin’ switch.
So the order in which Git for Windows sources configuration information is as follows:
- system config (e.g. C:\Program Files\Git\mingw64\etc\gitconfig)
- global config (%HOMEPATH%.gitconfig
- local config (repository-specific .git/config)
Perhaps this article might help the next soul who finds themselves trying to figure out from where some seemingly magical git setting is originating.