Skip to content

Instantly share code, notes, and snippets.

@KrashLeviathan
Last active August 19, 2016 03:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KrashLeviathan/3cd7d861eea4c9571ad033dd196a47be to your computer and use it in GitHub Desktop.
Save KrashLeviathan/3cd7d861eea4c9571ad033dd196a47be to your computer and use it in GitHub Desktop.
How to Work with GitHub and Multiple Accounts
# Got this handy tidbit from Jeffrey Way on tutsplus.com
# http://code.tutsplus.com/tutorials/quick-tip-how-to-work-with-github-and-multiple-accounts--net-22574
# This file goes in your $HOME/.ssh directory
# Default GitHub account (work or school)
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa
# Secondary GitHub account (personal projects)
Host github-krashleviathan
HostName github.com
User git
IdentityFile ~/.ssh/id_rsa_krashleviathan
# Make sure to create an ssh key for your personal account, and name it `id_rsa_krashleviathan`
# Then, make sure when you add remotes for personal projects, use:
# git remote add origin git@github-krashleviathan:KrashLeviathan/my_sweet_project.git
# If you get the `ERROR: Permission denied to...` message, you probably need to
# add the ssh key again with `ssh-add ~/.ssh/id_rsa_krashleviathan`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment