Multiple heroku accounts

前端 未结 14 1711
伪装坚强ぢ
伪装坚强ぢ 2020-12-04 05:01

I\'m having trouble when working with multiple Heroku accounts on my computer.

The thing is that it\'s worked great before by switching accounts with the heroku gem.

14条回答
  •  庸人自扰
    2020-12-04 05:41

    The Heroku plugin https://github.com/ddollar/heroku-accounts has been deprecated. Heroku now maintains its own at https://github.com/heroku/heroku-accounts. Unfortunately it doesn't seem to store project-by-project which account it should be using so you need to run

    $ heroku accounts:set account_name
    

    each time you want to use the Heroku command-line tool.

    Quick solution for people with access to the bash shell: make a local bin directory (it's already there in Rails applications) and create bin/heroku there. Contents:

    #!/bin/bash
    /usr/bin/heroku accounts:set account_name
    /usr/bin/heroku $*
    

    (replace "project_name" as appropriate) Then run

    $ chmod +x bin/heroku

    You can then run

    $ bin/heroku run console

    and it will automatically use the right Heroku account for you. Better still is to add ./bin to your path so you're back to just running:

    $ heroku run console

提交回复
热议问题