ProblemI have two accounts on Heroku, one is for my personal use and a new one for my demo related apps. I have installed the heroku-toolbelt already on my computer and have logged in using my personal account. Now I wanted to logged in as demo account but the console returns me the following:
$ heroku login Enter your Heroku credentials. Email: [EMAIL HERE] Password (typing will be hidden): Found existing public key: C:/Documents and Settings/AJ/.ssh/id_rsa.pub Uploading SSH public key C:/Documents and Settings/NCBaterina/.ssh/id_rsa.pub...failed! This key is already in use by another account. Each account must have a unique key.
Analysis and Solution
It seems that Git already generated SSH keys and saved it locally. Now since this will be sent to Heroku and your old account already used this, this will be considered invalid by the server.
To resolve this, we need to generate a new SSH key that we can use.
- First, we need to check the existing SSH keys on our computer. Run the following command:
$ cd ~/.ssh $ ls
lswill return you the following:
config id_rsa id_rsa.pub known_hosts
- Back-up your existing SSH keys before removing it
$ mkdir backup_keys $ mv id_rsa* backup_keys
Just a quick explanation, the first line creates a back-up directory while the second line moves the keys to the said directory.
- Now try logging again on
$ heroku login
This will prompt you again for you to create a new set of SSH keys.
$ heroku login Enter your Heroku credentials. Email: [EMAIL HERE] Password (typing will be hidden): Could not find an existing public key. Would you like to generate one? [Yn] y Generating new SSH public key. Uploading SSH public key C:/Documents and Settings/NCBaterina/.ssh/id_rsa.pub... done Authentication successful.