You need to ensure that you are using the correct ssh key.
The way to do this (and the way the heroku accounts plugin prompts you) is to add a section to your ssh config file in ~/.ssh/config. For instance, for my work heroku account I have this in my ssh config:
Now, and this is crucial, you need to make sure that your git remote is set up to use that same named host. In this case it is heroku.work. Normally it would be heroku.com if you were using heroku with only a single account.
So you'll need to edit the git remote (you can do this in the .git/config file of your repo on your machine). Change the file to look like:
I'd add a couple of things re the heroku-accounts plugin... this example assumes your pre-existing heroku account will be heroku.work and you are adding a new account heroku.personal.
It also describes how to move an app from one to the other, for example, if you have hit your 25-app max and are creating a new account and want to move some of your side projects and experimental apps out of your main account.
You probably need to use the plugin to create BOTH your old and your new accounts, eg, if you had one to start with you can't just add a new heroku.personal, you need to create heroku.work to replace your old one
You'll need to reassign your old apps to your heroku.work
if you are moving an app, don't assign the app to heroku.personal (using heroku accounts:set personal) until after you transfer the app using the heroku sharing commmand as described https://devcenter.heroku.com/articles/transferring-apps
So the steps you probably need are:
Install the heroku-account plugin
Go to heroku.com and create your new acount (if you don't have a second acount already)
run heroku accounts:add work --auto to create a new heroku.work account to replace your old default account (so use the same credentials you've been using all along). You ALSO need to upload your new key to heroku: heroku keys:add ~/.ssh/identity.heroku.work.pub
run heroku accounts:add personal --auto to create a new heroku.personal account (eg use your new credentials for your new heroku account). You ALSO need to upload your new key to heroku: heroku keys:add ~/.ssh/identity.heroku.personal.pub
For each app, cd to the project root then run heroku accounts:set work (all that does it setup git to use your heroku.work, which is (unin this example) the same heroku account you've been using all along, only now it's called heroku.work.
If you want to move an app from heroku.work to heroku.personal, (a) add the new heroku account as a collaborator with heroku sharing:add <new owner email> (b) in your local directory, switch the app to heroku.personal using heroku accounts:set personal (c) transfer** the app from the old account to the new account using heroku sharing:transfer <new owner email> then (d) remove the old email address collaborator (if you want to) using heroku sharing:remove <old owner email>
** Note the heroku link I provided says there are special requirements to move an app with any paid resources. Generally, remove the paid resoures, then add them back later, or have support do it.
I started using the heroku-accounts plugin but then realized my buddy could just make me a collaborator on his heroku account and that was all that was needed.
To get this to work for me with both Git and the Heroku console, I had to add create the ssh config as instructed by bantic, but I also had to create two remotes to my .git config:
This has been bugging me for a while, and I never found a solution that I liked. Finally found one.
(OS X specific answer.)
You can just create new users. Go to System Preferences -> Users & Groups -> Add user or group button. You can create a few users for different heroku accounts, I just named mine user1, user2, etc.
Then go to System Preferences -> Sharing -> Remote Login -> Allow access for: All Users
At this point, you can go to a terminal and do the following:
each time you want to use the Heroku command-line tool.
Quick solution for people with access to the bash shell: make a local bin directory (it's already there in Rails applications) and create bin/heroku there. Contents: