How to access multiple Heroku accounts from one Computer

Today I run into some trouble when I tried to access another Heroku account from my computer. After some research, I discovered¬†the heroku-accounts plugin, which completely solved my problem! ūüôā

Let’s see how it works…

The pluguin heroku-accounts manages multiple Heroku accounts for you. Assuming you have the Heroku toolbelt installed, you can install this pluguin with the command:

Then, you can configure each of your accounts. Let us start with an account named work:

and then, you’ll have to enter the corresponding Heroku credentials. This creates a new private Key.

As indicated by the message on your terminal, in the file ~/.ssh/config you will see the following:

Finally, to be able to push correctly our app to Heroku, we also need to change the Git configuration. In the .git folder of our app, edit or create a file named config and change the substring in the url from heroku.com to heroku.work, where we wrote the name of our account. Therefore, the final url in that file is:

In a similar way, you can create another account, which we call personal:

We can list the accounts we have defined by:

which returns

Finally, once we have our accounts set we can move from one account to the other with:

However, we need to be in the directory where exists the .git file to do this.

If you want to know which account is active, list the accounts and an * will appear on your active account. For example, if you have the personal account active:

Hope it was useful! ūüôā

Google+TwitterLinkedInFacebookReddit

Please, add +Marina Mele in your comments. This way I will get a notification email and I will answer you as soon as possible! :-)