SSH keys and multiple heroku accounts

Giff Constabletechnology

When you get stuck on tech ops problems, the web is your friend.  So I figured the least that I could do is contribute for the next person banging their head on this issue…

I have multiple heroku accounts for personal and work.  Yesterday, I found that I could not push from git to heroku for a new work project.  It was failing because it was trying to use the wrong SSH key, even though I was logged in correctly to Heroku (you can check this with $ heroku auth:whoami) and had definitely added the right key ($ heroku keys:add).

Here’s the two part solution that worked for me and helps manage multiple Heroku accounts:

– Use ddollar’s “heroku-accounts” plugin (thanks to Adam McCrea for showing that to me)

– Add a host to your ssh config file and make sure to update your git remote. Thank you Bantic for unsticking me here.