Setting up SSH Keys For Multiple Accounts

Like most people I have a work account and a personal account when working with repo's in Bitbucket. I needed a simple way to manage projects on both of these accounts.

What I did is clearly laid out here
https://confluence.atlassian.com/pages/viewpage.action?pageId=271943168

Understand

ssh - OpenSSH SSH client (remote login program)
sshd - OpenSSH SSH daemon
ssh-keygen - authentication key generation, management and conversion
ssh-add - adds RSA or DSA identities to the authentication agent
ssh-agent is a program to hold private keys used for public key authentication (RSA, DSA). 

Creating a new separate alias for additional account

$ ssh-keygen -f ~/.ssh/personal -C "personalid"
$ nano ~/.ssh/config
Host workdid
HostName bitbucket.org
IdentityFile ~/.ssh/workdid
Host personalid
HostName bitbucket.org
IdentityFile ~/.ssh/personalid
git@alias:accountname/reponame.git
$ git remote add origin git@personalid:{account}/{repo}.git

Check 

Adding the public keys within Bitbucket

Account > Manage Account > SSH Keys

 

ssh-add adds RSA or DSA identities to the authentication agent