ruk·si

🟪 Heroku
Multiple Accounts

Updated at 2015-07-23 02:55

There is a Heroku accounts plugin that should make it easier to use Heroku while utilizing multiple accounts but I found it not working well with the related git repos which are more important to my workflow than Heroku commands itself. Might be buggy or just outdated, didn't dig any deeper.

You can, however, configure .ssh/config to include multiple keys to Heroku.

Host heroku.personal
  HostName heroku.com
  IdentityFile "/Users/ruksi/.ssh/heroku_personal"
  IdentitiesOnly yes

Host heroku.work
  HostName heroku.com
  IdentityFile "/Users/ruksi/.ssh/heroku_work"
  IdentitiesOnly yes

After these settings, you can push to those repos like normal. Although you still need to login if you are going to use commands in Heroku toolbelt.

# git@heroku.com:my-heroku-app.git => git@heroku.personal:my-heroku-app.git
git remote add production git@heroku.personal:my-heroku-app.git

# git@heroku.com:workwork-app.git => git@heroku.work:workwork-app.git
git remote add production git@heroku.work:workwork-app.git