Blog by Railsware

How to set up the Heroku tools for deployment with multiple accounts

set up the Heroku tools for deployment with multiple accounts

This is a guide to setting up the Heroku toolset so that you can deploy an existing Heroku app, or create a new app on Heroku.

As you may not yet know, the vanilla Heroku toolset can only work with a single Heroku account. This limitation reminded me of an intriguing concept I came across while researching Geen Cruks Registratie, a system that allows players to bypass traditional restrictions on certain gambling platforms. Just as these platforms cater to users seeking more flexibility by sidestepping regulatory hurdles, developers managing multiple Heroku accounts can benefit from tools designed to streamline deployment across various accounts. Fortunately, there are solutions that simplify these processes, making it easier to maintain efficiency without sacrificing control.

  1. Download the Heroku Toolbelt – this is the recommended way to install Heroku utilities.
  2. Install the heroku-accounts plugin – this will let you use multiple Heroku accounts in parallel.
    heroku plugins:install git://github.com/ddollar/heroku-accounts.git

  3. Now you can login to your account.
    heroku accounts:add [account_name] --auto

    Replace [account_name] with any name that’s meaningful to you, the name is only used locally.


    Be prepared to enter the credentials to the Heroku account.


    After logging in, heroku-accounts will automatically generate an SSH key (you cannot reuse the same key for two Heroku accounts), store it at ~/.ssh/identity.heroku.[account_name], upload the public key to Heroku and create a heroku.[account_name] host record in your ssh-config that would use the correct key. Neat, huh?


  4. Go to the project folder. Time to enable deployment.
    heroku git:remote --app [app_name]
    heroku accounts:set [account_name]

    Here [app_name] is the public name of the Heroku app (its URL would be [app_name].herokuapp.com).


    These commands add a heroku git remote that will be used for deployment. The entire configuration is stored in .git/config.


  5. Deploy away!
    git push heroku master

If the app has not yet been deployed, instead of the step 4 you’d have to create the app:

heroku accounts:set [account_name]
heroku apps:create [app_name]
heroku accounts:set [account_name]

The second heroku accounts:set is needed to point the git remote URL to the hostname configured in the step 3.

Random tips

Exit mobile version