Changing .gitconfig location on Windows
Change HOME directory for this is wrong. Better is create symbolic link for gitconfig to HOME directory.
- Move your .gitconfig from user home directory, to the directory where you want.
- Run command line as Administrator
- Go to your user home directory
- Enter mklink .gitconfig \PathForNewLocationOfConfig.gitconfig
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 affect 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).