SSH keys for two accounts on GitHub
You cannot use the same SSH key for two accounts on GitHub. So you need two separate keys. This is how I did it, roughly following the guide Multiple SSH keys for different github accounts.
Let's assume that you have created a second account on GitHub with the username "secondaccount" and the e-mail address "secondaccount@example.com".
You need to create a new set of SSH keys. Do that with:
ssh-keygen -t rsa -C "secondaccount@example.com"
Where the e-mail address is the one you use for your second GitHub account. ssh-keygen will ask you for the name of the key to store. Tack on the user name_secondaccount" so it becomes "id_rsa_secondaccount".
Then you need to edit the ~/.ssh/config file. If it is not there, create it. Put the following into it:
#secondaccount account Host github.com-secondaccount HostName github.com User git IdentityFile ~/.ssh/id_rsa_secondaccount
This makes SSH associate a connection between the private key having the same ending as the domain after the dash sign (they could have different endings but in my experience naming everything the same where possible saves a lot of searching).
Then when checking out a repository from the second account, tack on "-secondaccount" to the Internet host, so if it looks like this initially:
git@github.com:secondaccount/my-git-repos.git
It will then look like this:
git@github.com-secondaccount:secondaccount/my-git-repos.git
Lastly, enter the repos and issue the following two commands:
git config user.name "secondaccount" git config user.email "secondaccount@example.com"
You should now be able to push to your second account from that repository.
Your first account should continue to work as normal. At least mine does.