TDD or not to Be

Developers journey to clean code.

Using Multiple Ssh-ids With Github

| Comments

Sometimes I need to interact with github using multiple ssh-keys. This is how I configure git to do it:

Lets create new rsa key

1
ssh-keygen

Then configure new key in github

1
  cat ~/.ssh/new_id_rsa.pub

When you try to push ssh-key-agent will use your old key. Create/Modify the file ~/.ssh/config

1
2
3
4
Host github.com-new_id_rsa
  HostName github.com
  User git
  IdentityFile ~/.ssh/new_id_rsa

Next open .git/config in your project and change url accordingly:

1
2

url = git@github.com-new-id-rsa:YOUR_USERNAME/YOUR_REPOSITORY.github.git

Now in your project directory you should be able to git push

Comments