Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the global git config data stored?

Tags:

git

config

When using git config --global to set things up, to which file will it write?

Example:

git config --global core.editor "blah" 

I can't find it at these places:

C:\Program Files\Git\etc\gitconfig  C:\myapp\.git\config 

I have not set an ENV?

My Git version: 1.6.5.1.1367.gcd48 – on Windows 7

like image 994
Ian Vaughan Avatar asked Jan 22 '10 00:01

Ian Vaughan


People also ask

How do I see my git global config?

List and show global git config. To see all of properties configured globally in Git, you can use the –list switch on the git config command. Adding the –show-origin switch will also tell you the global . gitconfig file's location.

Where are global git config stored Linux?

The global Git config file is in ~/. gitconfig , but there's also a "system" config file, that's usually in /etc/gitconfig .

Where is git config file Windows 10?

The file at %USERPROFILE%\. gitconfig is considered the master global file where you make all your changes. Run this command from within a Windows command shell to create a symbolic link for the system and global file.


2 Answers

I was also looking for the global .gitconfig on my Windows machine and found this neat trick using git.

Do a: git config --global -e and then, if you are lucky, you will get a text editor loaded with your global .gitconfig file. Simply lookup the folder from there (or try a save as...), et voilà! :-)

like image 44
MAD Avatar answered Sep 22 '22 20:09

MAD


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

git config --list --show-origin 

And with Git 2.26 (Q1 2020), you can add a --show-scope option

git config --list --show-origin --show-scope 

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

As Stevoisiak points out in the comments,

it will work with non-standard install locations. (i.e. Git Portable)

(like the latest PortableGit-2.14.2-64-bit.7z.exe, which can be uncompressed anywhere you want)


Original answer (2010)

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.

like image 149
VonC Avatar answered Sep 22 '22 20:09

VonC