I'd like to use multiple Git server accounts (with any of GitHub, GitLab, BitBubket etc.).
The accounts are distinguished by their email addresses, name1@email1.com and name2@email2.org and git is setup to use these addresses in the relevant repositories
The following constraints apply to the 'change-account workflow':
- Without touching/changing SSH config files (e.g.
~/.ssh/config
, etc.) when repositories or servers are added/removed/changed. - Without requiring SSH agent running i.e. no
ssh-add ...
. - Without changing environment variables.
- Without changing the
git clone <address>
instruction. - Isolate the SSH keys used with git away from other SSH keys.
- Use the same 'change-account workflow' across all private and public repositories.
- The 'change-account workflow' is a one (1) step/command.
- The 'change-account workflow' is one (1) time per repository (i.e. not each time you move into work on the repository).
The initial repository setup (which is also one time activity) can involve more than one step. Any conventions/assumptions are acceptable as long as they don't break the constraints.
Unrelated questions:
These are responses that do not satisfy the constraints.
They generally require changes to ~/.ssh/config
and/or involve the SSH agent daemon:
- handle-multiple-git-account
- using-multiple-git-accounts
- multiple-git-accounts-and-ssh-key
- multiple-github-accounts-ssh-config
- multiple-git-users-on-same-machine
- multiple-github-accounts-with-git-in-windows
- git-multiple-accounts-and-repository-problems
- ssh-config-to-access-multiple-repo-not-working
- multiple-github-accounts-on-the-same-computer
- can-i-specify-multiple-users-for-myself-in-gitconfig
- setting-up-ssh-config-file-for-multiple-codebase-accounts
- how-can-i-push-git-with-multiple-accounts-on-one-machine
- multiple-github-accounts-what-values-for-host-in-ssh-config
- how-to-configure-multiple-github-accounts-on-your-computer
- ssh-config-with-multiple-keys-for-multiple-gitlab-user-accounts
- github-multiple-accounts-permission-to-personalusername-reponame-git-denied-to