We'll first generate a new SSH key, by running:
ssh-keygen -t rsa -b 4096 -C "[email protected]"`
Name the key emu_rsa
so it doesn't overwrite your default id_rsa
key.
Open ~/.ssh/config
in a code editor and add this:
# Personal GitHub account
Host github.com
HostName github.com
User git
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
# EMU GitHub account
Host github.com-emu
HostName github.com
User git
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/emu_rsa
Run:
# Delete cached keys
ssh-add -D
# Add keys
ssh-add ~/.ssh/id_rsa
ssh-add ~/.ssh/emu_rsa
Go to https://github.com/settings/keys with your EMU profile and add a new SSH key with the content of emu_rsa.pub
:
cat ~/.ssh/emu_rsa.pub
Don't forget to also enable SSO for this for the organizations you plan to work on.
When working on an internal GitHub project, when cloning the repo replace the github.com
part with github.com-emu
, for example:
[email protected]:my-org/my-project.git
For working on personal project with your regular GitHub account, nothing changes.