0

[master +0 ~1 -0]> git --version
git version 1.9.5.msysgit.1

I found this answer -- https://stackoverflow.com/a/28520596/107037 -- but can't get it to work for me.
In my ~/.gitconfig, I have

[user]
name = CB
email = [email protected]
[include]  
path = "c:/common/git/commonConfig"  

then running

> git config --global -l  

produces

user.name=CB
[email protected]  
include.path=c:/common/git/commonConfig  

I have tried forward slashes, backslashes, quoting the path, not quoting the path....
The one combination I haven't tried is the one that works, apparently.
Thanks for any hints, this is a really powerful feature for sharing settings across computers.

4

3 Answers 3

1

If you're using git config -l to check whether the include is working as expected, you'll need to ensure that you're also providing the --includes argument, otherwise it doesn't perform the include processing.

The documentation states that it defaults to on, but it doesn't actually seem to be the case on Windows.

--[no-]includes
    Respect include.* directives in config files when looking up values. Defaults to on.
Sign up to request clarification or add additional context in comments.

1 Comment

That seems to work as desired. Marked as answer, thanks.
0

As a workaround, you can use the Unix form, with Cygwin this is

/cygdrive/c/common/git/commonConfig

With MSYS this should be

/c/common/git/commonConfig

1 Comment

Same result: include.path=/c/common/git/commonConfig
0

Why don't you put the file just next to the .gitconfig and use:

[include]
    path = ~/common.gitconfig

I did it the inverse way, including the personal data (email and name) and it works well...

PS: you could even use a relative path from here if you want.

2 Comments

I want to put the common config file in my skydrive directory, so it is easy to configure git on all computers I use. I use the same strategy for vim and powershell, and it works very well -- a computer-specific config file with a few local settings, and a way to include the common config file.
Well, this is confusing. It appears the include.path is generally working as desired, but not for git config --global -l -- that seems to merely read ~\.gitconfig w/o processing the include. Continuing to experiment, but path = c:/common/git/commonConfig seems to be working (my difftool settings are recognized, for example).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.