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 = cb@gmail.com
[include]  
path = "c:/common/git/commonConfig"  

then running

> git config --global -l  

produces

user.name=CB
user.email=cb@gmail.com  
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.

Community
  • 1
  • 1
Number8
  • 12,322
  • 10
  • 44
  • 69

3 Answers3

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.
MrJoel
  • 44
  • 4
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
Zombo
  • 1
  • 62
  • 391
  • 407
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.

Philippe
  • 28,207
  • 6
  • 54
  • 78
  • 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. – Number8 Jun 03 '15 at 11:06
  • 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). – Number8 Jun 03 '15 at 14:26