Git 用户取决于远程 url
Git user depending on remote url
我想根据远程 url 在 git 中使用不同的 user.name
/user.email
。我试过 gitlab 和 gitea 实例但没有成功。
我尝试在 documentation 之后使用 includeIf
。
~/.gitconfig
[includeIf "hasconfig:remote.*.url:https://git.example.com/**"]
path = ~/.gitconfig-git.example.com
~/.gitconfig-git.example.com
[user]
email = admin@example.com
name = Admin
在 git 存储库中,我无法获取用户。
> git config --get remote.origin.url
https://git.example.com/organisation/repository
> git config --get user.email
> git config --get user.name
我做错了什么?
我提到 新设置作为配置文件条件包含机制的新值,使用“[includeIf <condition>]
”
这意味着如果您的 Git 不是 2.36,则将忽略新条件值。
我想根据远程 url 在 git 中使用不同的 user.name
/user.email
。我试过 gitlab 和 gitea 实例但没有成功。
我尝试在 documentation 之后使用 includeIf
。
~/.gitconfig
[includeIf "hasconfig:remote.*.url:https://git.example.com/**"]
path = ~/.gitconfig-git.example.com
~/.gitconfig-git.example.com
[user]
email = admin@example.com
name = Admin
在 git 存储库中,我无法获取用户。
> git config --get remote.origin.url
https://git.example.com/organisation/repository
> git config --get user.email
> git config --get user.name
我做错了什么?
我提到 [includeIf <condition>]
”
这意味着如果您的 Git 不是 2.36,则将忽略新条件值。