Skip to content

Instantly share code, notes, and snippets.

@logeshpaul
Last active August 29, 2015 14:16
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 logeshpaul/b54c81d81eefab8370f8 to your computer and use it in GitHub Desktop.
Save logeshpaul/b54c81d81eefab8370f8 to your computer and use it in GitHub Desktop.
Managing multiple Github accounts

Step 1 - Create a New SSH Key

ssh-keygen -t rsa -C "your-email-address"

Step 2 - Name your SSH Key

When prompted, save the file as id_rsa_COMPANY.

Step 3 - Attach the New Key

Add your newly added SSH key

ssh-add ~/.ssh/id_rsa_COMPANY

Step 4 - Create a Config File

touch ~/.ssh/config
vim config

Step5 - Fill in your config

#Default GitHub
Host github.com
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_rsa
  
#Company GitHub
Host github-COMPANY
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_rsa_COMPANY
````
  
**Step6 - Add ssh key to github**

Copy the ssh key from your machine and add it to the github account

`pbcopy < ~/.ssh/id_rsa.pub`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment