Skip to content

Instantly share code, notes, and snippets.

@sixertoy
Last active August 29, 2015 14:10
Show Gist options
  • Save sixertoy/aee46071d7bbd8ffb288 to your computer and use it in GitHub Desktop.
Save sixertoy/aee46071d7bbd8ffb288 to your computer and use it in GitHub Desktop.
Multiple Github Accounts

Remove SSH Key

ssh-add -D

List SSH Key

ssh-add -l

Create SSH Key

ssh-keygen -t rsa -C "your-email-address"
/c/Users/user/.ssh/id_rsa_whatever
clip < ~/.ssh/id_rsa_whatever.pub

Paste Key to Github Launch SSH-agent (Windows)

eval `ssh-agent -s`
ssh-add ~/.ssh/id_rsa_whatever

If not exists create config file

touch ~/.ssh/config
vim ~/.ssh/config

Edit config

# Default GitHub
Host github.com
 HostName github.com
 User git
 IdentityFile ~/.ssh/id_rsa_whatever
 
# Company GitHub
Host github-company
 HostName github.com
 User git
 IdentityFile ~/.ssh/id_rsa

Git repository add origin

Default github repo

git remote add origin [email protected]:company/repository.git

Company github repo

git remote add origin git@github-company:company/repository.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment