- Create an SSH key and add the public key to GitLab/Hub/Tea/whatever.
- Add a
Hostentry in~/.ssh/configwith a custom alias, pointing to the real domain and your specific key:
# Only for `git@acme-corp:org/repo` commands.
Host acme-corp
HostName gitlab.com
User git
IdentityFile ~/.ssh/acme-corp
IdentitiesOnly yes
# Only for `git@abc-llc:org/repo` commands.
Host abc-llc
HostName gitlab.com
User git
IdentityFile ~/.ssh/abc-llc
IdentitiesOnly yes
# All other git commands (including personal ones).
Host gitlab.com
HostName gitlab.com
User git
IdentityFile ~/.ssh/id_ed25519
IdentitiesOnly yes- Use
git@acme-corp:org/repo.gitin clone commands:
git clone git@acme-corp:redteam9000/super-cool-exploit.git- Done.