Ian Vaughan Ian Vaughan - 3 months ago 8
Git Question

Where does git config --global get written to?

Using the git config --global command to set things up, where is the file?

eg :

git config --global core.editor "blah"


Its not at these places :-

C:\Program Files\Git\etc\gitconfig

C:\myapp\.git\config


I have not env set?

git version 1.6.5.1.1367.gcd48 on Windows7

Answer

From the docs:

--global

For writing options: write to global ~/.gitconfig file rather than the repository .git/config.

Since you're using Git for Windows, it may not be clear what location this corresponds to. But if you look at etc/profile (in C:\Program Files\Git), you'll see:

HOME="$HOMEDRIVE$HOMEPATH"

Meaning:

C:\Users\MyLogin

(on Windows 7)

That means the file is in C:\Users\MyLogin\.gitconfig for Git in Windows 7.


Note: with git 2.8 (March 2016), you can simply use:

git config --list --show-origin

You will see which config is set where.
See "Where do the settings in my Git configuration come from?"

Comments