Do you mean the user which is used to authenticate against each remote? Then yes — just embed the user name to the remote's URL.
Using a separate user for multiple Git remotes on the same repository
-
04-04-2022 - |
Question
Is there a way to clone a repository, add a second remote, but use a different/separate user for that second remote automatically when pushing/pulling?
My use case is to have the remote "origin" only for pulling (actually checking out) changes with "user A" and to have remote "my-second-remote" for pulling AND pushing with "user B".
Is there a way to set up a separate user for each remote?
Solution
OTHER TIPS
No, this is impossible in Git. Name and email are embedded in the commits.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow