'Git user depending on remote url
I would like to use different user.name/user.email in git depending on remote url. I've tried with gitlab and gitea instances without success.
I've tried to use includeIf following documentation.
~/.gitconfig
[includeIf "hasconfig:remote.*.url:https://git.example.com/**"]
path = ~/.gitconfig-git.example.com
~/.gitconfig-git.example.com
[user]
email = [email protected]
name = Admin
Inside a git repository, I am unable to get the user.
> git config --get remote.origin.url
https://git.example.com/organisation/repository
> git config --get user.email
> git config --get user.name
What am I doing wrong ?
Solution 1:[1]
I mentioned the 2.36 hasconfig:remote.*.url: new setting as a new value for the conditional inclusion mechanism of configuration files using "[includeIf <condition>]"
That means if your Git is not at 2.36, said new condition value would just be ignored.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | VonC |
