I have a repository in my local machine. This repository has 2 git remotes. Remotes A and B.
- Remote A requires
user.nameX anduser.emailY. - Remote B requires
user.nameZ anduser.emailW.
Can this be achieved in git? If so, how?
I have a repository in my local machine. This repository has 2 git remotes. Remotes A and B.
user.name X and user.email Y.user.name Z and user.email W.Can this be achieved in git? If so, how?
With Git 2.13, you now have conditional include for git config, but it is only based on filesystem path of the repository.
So you still need two different copies of the same repo. You can achieve that with git worktree (one clone, multiple working tree)
You can then modify your global config spec to include a local config with a specific set of user.name/user.email depending on your current folder.
See "Using different Git emails" from pltvs (Alex Pliutau)
I think you can achieve by doing something like this by using --local instead of --global
A
git config user.email Y
git config user.name "X"
B
git config user.email W
git config user.name "Z"
The values stored in the .git/config for particular repo than the global configuration file.