Creating Multiple SSH Key Settings For Github Accounts

Posted on Wed 29 March 2017 in git

Create a new ssh key for the second account

$ ssh-keygen -t rsa -b 4096 -f "$HOME/.ssh/masecondgit_rsa

Create an ssh config

Create a file at ~/.ssh/config

# create the first host to use your original key as default
    IdentityFile ~/.ssh/id_rsa
    User mikeabrahamsen

# create a second host to use with the second github account
    User mikeabrahamsen
    IdentityFile ~/.ssh/masecondgit_rsa

Now to use the second account with the ssh key use the following when you clone:

# notice the '-secondgit' before the ':'
git clone

If you want to add this to an already created repo

git remote add origin [email protected]:mikeabrahamsen/dotfiles.git