Supporting multiple Heroku accounts from the CLI

Written on August 28, 2018

Working in Ruby on Rails applications, the apps get deployed to Heroku for hosting. Heroku provides an elegant experience where you can deploy sites and interact with your Heroku account via the command line using their CLI.

When working with clients for software projects, our clients would set up a Heroku account. This allows for the cost of hosting to be passed through to the client, and we’re given access to manage their application’s hosting.

The issue with this is, by default Heroku’s CLI can only support a single login at one time. This makes managing multiple Heroku apps a little annoying. Since you’ll have to log out and log back into various accounts and keep track of login credentials.

It turns out, the Heroku CLI has a plugin for managing multiple accounts. With this plugin installed, you can manage all your accounts and then easily swap accounts as they are needed. Which is nice so you can have your personal account alongside client accounts all available without logging in and out from the CLI.

Stay in touch

Thanks for reading this article. I'd love to stay in touch and share more tips on programming and side projects with you. Sign up and I'll send you my articles straight to your email, you'll also get a free copy of the light themed version of my Git cheat sheet.
Git cheat sheet preview image