воскресенье, 15 декабря 2019 г.

Multiple GitHub repositories with different ssh keys

Sometimes you need to have different repositories in sync via ssh, so you don't need to enter login and password each time.

To setup multiple directories with different ssh keys you'll need:

1. Create your keys (2 different):
ssh-keygen -t rsa -b 4096 -C "my_work_email@my_company.com"
2. Add your public keys in github repositories respectively - GitHubHelpSSHkeys
3. Make your ~/.ssh/config file look similar:

# Personal GitHub account
Host github.com-personal
    HostName github.com
    User git
    AddKeysToAgent yes
    UseKeychain yes
    IdentityFile ~/.ssh/personal_rsa