views:

57

answers:

1

Does Git have anything like Hg's HGRCPATH, i.e. an enviromental variable which you can modify to change the location where Hg will search for its global configuration file.

In git that can be somewhat accomplished by changing HOME, but that will affect unknown number of other applications, which is why I'm trying to avoid it.

+2  A: 

There's environmental variable called GIT_CONFIG:

Take the configuration from the given file instead of .git/config. Using the "--global" option forces this to ~/.gitconfig. Using the "--system" option forces this to $(prefix)/etc/gitconfig.

Also check git docs for more information about git configs.

Ondrej Slinták
I've read that on my way over here, but I'm still confused - what would I have to change for it to search for "c:\config_files\.gitconfig" instead of in "c:\docu...and settings\username\.gitconfig"? (but so that I don't have to give the position of it every time I open up a new repo)
Rook
By default, GIT_CONFIG doesn't exist as environmental variable. You have to set it in Windows and set its value to "/c/some/folder/.gitconfig". You can try if it works by typing "echo $GIT_CONFIG" into Git console.
Ondrej Slinták
Doesn't work. I created GIT_CONFIG env. var. with a path to my .gitconfig (C:\temp\.gitconfig) and although it echoes that env. variable it stills uses the settings from my old .gitconfig. Working under XP here (but I gather you guessed that by now ...)
Rook
Do you set those new options with --global parameter?
Ondrej Slinták
@Ondrej - Uhm, no. I just setted the env. var, moved the file from c:\doc...settings\username\ to c:\temp and edited it, and changed the name in it to see whether something will change. What else do I need to set? I find Git's documentation very confusing for now.
Rook