Reference: Multiple SSH Keys settings for different github account & How to Work with GitHub and Multiple Accounts
-t rsaSpecifies the type of key you are creating, in this instance is an RSA key
-C email@email.comThis puts a comment at the end of your public key so its easier to see which key is yours
> ssh-keygen -t rsa -C "email@email.com"
> Enter file in which to save the key (/Users/USERNAME/.ssh/KEY_NAME):
> Enter passphrase (empty for no passphrase):The ssh-add command prompts the user for a private key password and adds it to the list maintained by ssh-agent. Once you add a password to ssh-agent, you will not be prompted for it when using SSH or scp to connect to hosts with your public key.
> ssh-add ~/.ssh/KEY_NAME #without the .pubOpen ~/.ssh/config to create new ssh config entries.
Host server-name
HostName sub.server-name.com
User username
IdentitiesOnly yes
IdentityFile ~/.ssh/id_rsa> ssh server-nameThe alternative is to use ssh command that includes this info.
ssh -i ~/.ssh/some.pem username@sub.server-name.com-ioption should point toidentity_file.
Replace USERNAME with your GitHub usernames
Host github.com-USERNAME
HostName github.com
User USERNAME
IdentityFile ~/.ssh/KEY_NAME.pub> git remote get-url origin
git@github.com-<USERNAME>/digital-ocean.git
> git remote set-url origin git@github.com-<USERNAME>:<REPO>/digital-ocean.git
git@github.com-<USERNAME>:<REPO>/digital-ocean.git