Heroku Toolbelt switch between multiple account
Asked Answered
P

3

39

I would like to know what's the best way to switch between heroku account using the heroku toolbelt.

I'm used to have a personnal heroku account which is a collaborator of all of my professionnal heroku app. The problem is when I want to make some changes that have a financial impact : adding / removing addon for example, I cannot do it as a collaborator.
Before heroku toolbelt I was used to change the content of the file ~/.heroku/credentials but it does not exists anymore with the toolbelt.

Peper answered 30/10, 2012 at 13:45 Comment(0)
B
32

Have you tried the heroku accounts plugin?

Bree answered 11/11, 2012 at 12:25 Comment(4)
After installing it, Toolbelt gives me this: WARNING: deprecated ddollar/heroku-accounts plugin is installed.Regularize
ah, this comment is two years old, heroku might have a different solution for multiple accounts alreadyBree
Heroku now supports this functionality with an official fork of this plugin github.com/heroku/heroku-accountsCorriveau
This shouldn't be a plugin, it should be included in the CLI by default. Thanks for sharing.Eelpout
P
25

In 2017, Heroku released heroku-accounts, an add-on to the toolbelt that lets one quickly switch accounts from the command line. Install it like this:

heroku plugins:install heroku-accounts

Then add an account ("work" in this case):

heroku accounts:add work

At this point, you'll need to provide the credentials you want associated with the "work" alias. Do the same for other accounts you have. Then switch between aliases like this:

heroku accounts:set work

(Sorry to zombie this question.)

Piggyback answered 15/2, 2018 at 8:56 Comment(2)
The other answer was edited to be the same as this one. That's kinda cheesy.Piggyback
Thank you very much @IAmNan! Now I can switch between multiple Heroku accounts!Kamikamikaze
G
11

You can just run the login again from the command line:

heroku login

Enter your new email and password for the other account.

Goggles answered 7/12, 2015 at 19:26 Comment(6)
it's too troublesome if we need to login and logout multiple times (and also entering password again and again) just to switch account.Statampere
exactly what i was looking forBlasius
Might not be the most efficient answer, but it helped me out!Turbojet
It's not working, the browser is just providing a button which says login. How can I login using a different account, after the "heroku login" command?Coincide
You have to create a new profile in your browser, log in to heroku.com and save the password, make sure the browser you're using is your default browser, make sure it's the only open browser window, and run heroku login. Now you can hit the "Login" button and log in to the CLI. I didn't wanna do all this, that's why I looked up "Multiple accounts in Heroku CLI" and came to this page. I think @IAmNaN's answer could help me. I'm not sure...Kamikamikaze
Okay now I've tested @IAmNan's answer. It works.Kamikamikaze

© 2022 - 2024 — McMap. All rights reserved.