Skip to content

Latest commit

 

History

History
35 lines (23 loc) · 826 Bytes

ssh.md

File metadata and controls

35 lines (23 loc) · 826 Bytes

SSH

How to use separate accounts for different repositories on GitHub

Let's say we want to use separate GitHub accounts. One user for personal use and a different one for work.

Assuming you have keys for each (e.g. ~/.ssh/personal_id_rsa, and ~/.ssh/work_id_rsa).

On your ~/.ssh/config, you should have:

Host personal.github.com
  HostName github.com
  IdentityFile ~/.ssh/personal_id_rsa

Host github.com
  HostName github.com
  IdentityFile ~/.ssh/work_id_rsa

And when you want to clone a repository for personal use:

git clone [email protected]:username/repo

And when you want to clone a repository for work:

git clone [email protected]:username/repo

Links