I want to specify separate gitconfig settings for projects inside a "work" directory, using the "includeIf" directive.
I have ~/.gitconfig
:
[user]
name = Dustin Michels
email = my@personal-email.com
(...)
[includeIf "gitdir:~/GitRepos/Work/"]
path = ~/.gitconfig-work
And ~/.gitconfig-work
:
[user]
name = Dustin Michels
email = my@work-email.com
When I naviagte into the ~/GitRepos/Work/
directory, or a Git project within, I still see the old settings.
$ git config user.email
me@personal-email.com
Or
$ git config --list
user.name=Dustin Michels
user.email=me@personal-email.com
(...)
includeif.gitdir:~/GitRepos/Other/.path=/.gitconfig-work
It seems that the directive is not being recognized? Or something else is wrong? I am using Ubuntu and git version 2.25.1.