User name and email must be set before commit error with includeIf hasconfig:remote.*.url in .gitconfig
What steps will reproduce the problem?
- Create %USERPROFILE%\.gitconfig file with
[includeIf "hasconfig:remote.*.url:git@gitlab.xxx:*/**"]
path = ~/.gitconfig-xxx
[includeIf "hasconfig:remote.*.url:git@gitlab.yyy:*/**"]
path = ~/.gitconfig-yyy
- Create %USERPROFILE%\.gitconfig-xxx file with:
[user]
name = User1
email = user1@xxx
- Create %USERPROFILE%\.gitconfig-yyy file with:
[user]
name = User2
email = user2@yyy
What is the expected output? What do you see instead?
When I commit in a working copy of the xxx remote I expect that the TortoiseGit will use ~/.gitconfig-xxx to configure user When I commit in a working copy of the yyy remote I expect that the TortoiseGit will use ~/.gitconfig-yyy to configure user
When I use the git command line interface to see config, I see the correct user
>cd xxx
>git config -l
...
remote.origin.url=git@gitlab.xxx:xxx/xxx.git
includeif.hasconfig:remote.*.url:git@gitlab.xxx:*/**.path=~/.gitconfig-xxx
includeif.hasconfig:remote.*.url:git@gitlab.yyy:*/**.path=~/.gitconfig-yyy
user.name = User1
user.email = user1@xxx
...
>cd ../yyy
>git config -l
...
remote.origin.url=git@gitlab.yyy:yyy/yyy.git
includeif.hasconfig:remote.*.url:git@gitlab.xxx:*/**.path=~/.gitconfig-xxx
includeif.hasconfig:remote.*.url:git@gitlab.yyy:*/**.path=~/.gitconfig-yyy
user.name = User2
user.email = user2@yyy
...
What version of TortoiseGit and Git are you using? On what operating system?
TortoiseGit 2.15.0.0 (C:\Program Files\TortoiseGit\bin) git version 2.42.0.windows.2 (C:\Program Files\Git\bin; C:\Program Files\Git\mingw64; C:\Program Files\Git\etc\gitconfig) OS: Windows 10 Pro 64 bit
Please provide any additional information below.
Edited by Anatoly Shirokov