Last Updated: February 25, 2016
· joakley77

Multiple Git accounts on one box

I recently found myself having to push code to multiple repos. Surprisingly, nobody at work knew how to do this or had any experience with it so I took it upon myself Google.

First, let's open up your flavor of Terminal and create a series of ssh keys. Use a naming scheme that makes them easy to understand and make sure each file uses a different name.

ssh-keygen -t rsa -f ~/.ssh/ -C ""

ssh-keygen -t rsa -f ~/.ssh/id_rsa.github.home -C ""

You now need to create a ssh config file to store these references:

touch ~/.ssh/config
chmod 600 ~/.ssh/config
echo 'IdentityFile ~/.ssh/" >> ~/.ssh/config
echo 'IdentityFile ~/.ssh/id_rsa.github.home" >> ~/.ssh/config

Copy your ssh key to clipboard. Change the key filename accordingly.

pbcopy < ~/.ssh/

sudo apt-get install xclip
xclip -sel clip < ~/.ssh/

clip < ~/.ssh/

Hop on over to Github/Bitbucket/whatever and add your new ssh key. That's it!

Original credit on how to do this: