Jessica Lord, open web developer—designer

Multiple Heroku Accounts

  • By Jessica Lord
  • 2012-11-25
  • heroku, web dev

I finally actually sat down to tackle my multiple Heroku accounts problem. I started by following Chris's comment and using a plugin. Something went awry, probably my fault, but I eneded up uninstalling it (which turns out to be a pain) and figuring out how to do what it does manually.

Create new keys for accounts

First, create new keys for each of the accounts you’re setting up. For me that’s a work account and personal account.

ssh-keygen -t rsa -C ""

When it asks what to name it, give it a name that's easy to recall, like

Configure your system .ssh

Next, you have to edit your .ssh/config file and set up new hosts. If you use Textmate, you can type mate ~/.ssh/config in terminal. Add these lines, changing out the work/personal and IdentityFile to match your needs/keys.

 IdentityFile ~/.ssh/
 IdentitiesOnly yes
Host heroku.personal
 IdentityFile ~/.ssh/identity.heroku.personal
 IdentitiesOnly yes

Configure your git repo

Now edit the .git/config files. Inside of your root directory for the repo, type mate .git/config to open the file. It will look something like this, but under [remote "heroku"] you will change the url from to (or whatever you're calling your different accounts).

 repositoryformatversion = 0
 filemode = true
 bare = false
 logallrefupdates = true
 ignorecase = true
[branch "master"]
[remote "heroku"]
 url =
 fetch = +refs/heads/*:refs/remotes/heroku/*
[remote "origin"]
 url =
 fetch = +refs/heads/*:refs/remotes/origin/*

Tell Heroku which keys to use

In Terminal, navigate to the root directory for the repo and heroku login to the account associated with that repo. You'll need to tell heroku what key to use with that account.

heroku keys:add ~/.ssh/

Repeat for other repos you have associated with that account. Then navigate to the root of a repo with a different account, make sure to now heroku login with your other account login information. Repeat the steps for adding the keys to this account (only add the other account, ie, identity.heroku.personal).

So many keys, so much fun. If you are like me and had made a hot mess of keys, it may be useful to list your keys (in heroku and on your computer), see what's going on and clean up. Now I have one key that github uses and two keys for my two Heroku accounts and things are running much more smoothly.


  1. Heroku Accounts plugin Github
  2. Multiple Heroku Accounts Stackoverflow Answer
  3. Keys in Heroku Dev