Last Updated: September 09, 2019
· jmarizgit

Multiple github accounts in one computer

Today I've created my second github account after a long time using the service as single user. This account is mostly for professional works in addition to my personal account for open source projects.

I had never had two accounts and was a little lost at first. Here is how I managed my problem (I hope help others):

1. Generate SSH Key for new github user

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

When asked which file write the following:


This will generate two files idrsagithubusername and

You can manually add that to your ssh keys

ssh-add -K id__rsa__githubusername

2. Add new SSH Key to your user on

copy the content of

$ pbcopy < ~/.ssh/
  1. go to
  2. click in ADD SSH KEY button on the right
  3. paste the content of and save it

3. Create SSH config file

$ touch ~/.ssh/config

4. Edit SSH config file with your accounts information

#Default GitHub
Host github-username  //name to identify github account
HostName  //don't change this
User githubusername  //username on github
IdentityFile ~/.ssh/id_rsa_githubusername   //ssh key created

5. Cloning repository for the new user

git clone git@github-username:user/repo.git

NOTE: we change with github-username as specified on our SSH config file.