When is the global .gitconfig file created?
First off, git doesn't automatically create the global config file (.gitconfig) during its installation. The file is not created until it is written to for the first time. If you have never set a system variable, it will not be on your file system. I'm guessing that might be the source of the problem.
One way to ask Git to create it is to request an edit. Doing so will force the file's creation.
git config --global --edit
If you monitor the user's home folder when you issue this command, you will see the .gitconfig file magically appear.
Where is git configuration stored?
Here's a quick rundown of the the name and location of the configuration files associated with the three Git scopes, namely system, global and local:
- System Git configuration: File named gitconfig located in -git-install-location-/ming<32>/etc
- Global Git configuraiton: File named .gitconfig located in the user's home folder (C:\Users\git user)
- Local Git configuration: File named config in the .git folder of the local repo
Of course, seeing is believing, so here's an image showing each file and each location. I pulled the image from an article I wrote on the topic.
Windows Git configuration file locations (TheServerSide.com)
git config --global --edit
should tell you the exact location no matter what kind of setup you have--just look at what file comes up in your editor. – Hildygit config --global --list
was also useful for when it doesn't exist as it gave the location of where git is expecting it to be. – Piraeusgit config --global --edit
you'll probably end up in vim. From vim to get the full file path you can enter:echo expand(':%p')
-- vim.wikia.com/wiki/Get_the_name_of_the_current_file – Secessionist:echo expand('%p')
, i.e. without the colon inside the call toexpand
– Commentatorstrace -fefile
in front of a command will show you every path it touches by name. sostrace -fefile git config --global -l
. – Femineity