tags:

views:

34

answers:

2

By default on Windows Git places global .gitconfig in c:\documents and settings\user\

How can I change that position so .gitconfig is stored in c:\my_configuration_files\?

Can it be done at all?

A: 

Look in the FILES and ENVIRONMENT section of git help config.

Stefan Näwe
+1  A: 

If you set HOME to c:\my_configuration_files\, then git will locate .gitconfig there. Editing environment variables is described here. You need to set the HOME variable, then re-open any cmd.exe window. Use the "set" command to verify that HOME indeed points to the right value.

Changing HOME will, of course, also effect other applications. However, from reading git's source code, that appears to be the only way to change the location of these files without the need to adjust the command line. You should also consider Stefan's response: you can set the GIT_CONFIG variable. However, to give it the effect you desire, you need to pass the --global flag to all git invocations (plus any local .git/config files are ignored).

Martin v. Löwis
Uhmm, just a newbie here. Could you be a little more descriptive on how to do that? Please :)
Rook
See my edit above.
Martin v. Löwis
Hmm, not sure if I understood correctly but won't changing HOME have an influence to also all other applications which use it? Isn't there a way to change HOME, but local to Git?
Rook
Yes, it would have effect on other applications as well. You asked how to change the location, and I told you. See my edit.
Martin v. Löwis