Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
configure multiple github accounts on the same

SSH keys


ssh-keygen -o

You can view the created files (one without extension and one with .pub) under ~/.ssh/. When creating several of them, you may want to rename them appropriately (e.g. work, pers...).

Add them

to the relevant github account:


The configuration file for ssh is usually not created by default so we create it:

touch ~/.ssh/config

Now paste in the config file the following:

# work account
 User git
 IdentityFile ~/.ssh/work

 # personnal account
 User git
 IdentityFile ~/.ssh/pers


Usually, the ssh clone url looks like this:<account>/<project>.git

To link the right ssh key, prepend to <account> either pers. or work depending on who should be committing. This results in the following git clone command:

git clone<account>/<project>.git

Now you can commit as you want and work on your cloned project with the right user.

Next steps

  • what is keychain parameter in config file
  • why is the commit user kinda ugly looking in github when looking at the commit history?


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment