Skip to content

Instantly share code, notes, and snippets.

@GitAlison
Created April 22, 2022 22:50
Show Gist options
  • Save GitAlison/335852905fda2511a27aa53ba9c76583 to your computer and use it in GitHub Desktop.
Save GitAlison/335852905fda2511a27aa53ba9c76583 to your computer and use it in GitHub Desktop.
# Create keys
cd .ssh/
# Generate SSH key for each GitHub account
ssh-keygen -t rsa -C "[email protected]"
ssh-keygen -t rsa -C "[email protected]"
~/.ssh/id_rsa_personal
~/.ssh/id_rsa_work
$ ssh-add ~/.ssh/id_rsa_activehacker
$ ssh-add ~/.ssh/id_rsa_jexchan
# Configure users
$ git config user.name "work"
$ git config user.email "[email protected]"
$ git config user.name "personal"
$ git config user.email "[email protected]"
Add you reference keys
Create file in ~/.ssh/config
#Personal account
Host github.com-peronal
HostName github.com
User git
IdentityFile ~/.ssh/personal
#Work account
Host github.com-work
HostName github.com
User git
IdentityFile ~/.ssh/work
#Clone example
git clone [email protected]:personal/repository.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment