Simple DevOps: Managing multiple ssh keys in a single computer

Sometimes you might be using 2 seperate accounts for a specific service in the internet. Say for example you have two github/heroku/bitbucket accounts, you’d want to use ssh keys in order for you to easily push to your repositories and work with those services. But using one ssh key for those accounts is not allowed by these service due to a security measure.

For you to get around this, you can create multiple ssh keys in your machine and add them to your terminal session.

Generating another ssh-key

 ssh-keygen -t rsa -f ~/.ssh/id_rsa_work -C "Keyword stuff label"

This command will generate a id_rsa_work key for you, to add this on top of your usual ssh key just run:

exec ssh-agent bash

ssh-add ~/.ssh/id_rsa_work

Now you’re using two ssh keys in a single session :)