2

I've recently upgraded to git version 2.33.1.windows.1
and includeif does not seem to be working.
Can anyone else confirm? I can't remember what my previous git version was.

My config is as follows:

.gitconfig

[user]
  name = crowne
  email = crowne@fakemail.com
[includeIf "gitdir:E:/work/**"]
  path = ~/.gitconfig_work

.gitconfig_work

[user]
    name = name.surname
    email = name.surname@work.com

The reason I upgraded was that the includeif was not taking effect recursively
on directories nested more than one directory below E:/work/

Since the upgrade it doesn't seem to be taking effect at all.

>git config -l --show-origin

Only shows entries from:

  • C:/Program Files/Git/etc/gitconfig
  • C:/Users/crowne/.gitconfig

I don't see any entries from:

  • C:/Users/crowne/.gitconfig_work
crowne
  • 8,336
  • 2
  • 34
  • 48
  • 1
    Try `[includeIf "gitdir/i:E:/work"]` (case-insensitive, no `**`). – phd Nov 16 '21 at 12:59
  • I tried, but its still not working – crowne Nov 17 '21 at 12:53
  • This is no longer a problem for me, I'm currently on git version 2.34.1.windows.1 however I'm also on a new computer and my work include path is now [includeIf "gitdir/i:**/work/**"] path = ~/.gitconfig_work – crowne Feb 22 '22 at 07:49

1 Answers1

2

I have tried git v2.35.1 and the magic was for me, to drop the ** in the end and keep the trailing slash / alone. I added also the /i option to ignore be case-insensitive.

.gitconfig, which worked for me

[user]
  name = crowne
  email = crowne@fakemail.com
[includeIf "gitdir/i:E:/work/"]
  path = ~/.gitconfig_work

not working a)

[user]
  name = crowne
  email = crowne@fakemail.com
[includeIf "gitdir/i:E:/work/**"]
  path = ~/.gitconfig_work

not working b)

[user]
  name = crowne
  email = crowne@fakemail.com
[includeIf "gitdir/i:E:/work"]
  path = ~/.gitconfig_work
KargWare
  • 1,208
  • 2
  • 14
  • 31
  • similar issue under ubuntu, after switched from Bionic (git v2.17) to Focal (git v2.25.1), I had `[includeIf "gitdir:~/workspace/*"]` and it worked under old version. Now I remove * : `[includeIf "gitdir:~/workspace/"]` equivalent to _/home/myusername/workspace/**_ and it works fine, https://stackoverflow.com/a/54125961/6614155 – bcag2 May 27 '22 at 12:21