Multiple heroku accounts

前端 未结 14 1613
伪装坚强ぢ
伪装坚强ぢ 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:34

    I'd add a couple of things re the heroku-accounts plugin... this example assumes your pre-existing heroku account will be heroku.work and you are adding a new account heroku.personal.

    It also describes how to move an app from one to the other, for example, if you have hit your 25-app max and are creating a new account and want to move some of your side projects and experimental apps out of your main account.

    1. You probably need to use the plugin to create BOTH your old and your new accounts, eg, if you had one to start with you can't just add a new heroku.personal, you need to create heroku.work to replace your old one
    2. You'll need to reassign your old apps to your heroku.work
    3. if you are moving an app, don't assign the app to heroku.personal (using heroku accounts:set personal) until after you transfer the app using the heroku sharing commmand as described https://devcenter.heroku.com/articles/transferring-apps

    So the steps you probably need are:

    1. Install the heroku-account plugin
    2. Go to heroku.com and create your new acount (if you don't have a second acount already)
    3. run heroku accounts:add work --auto to create a new heroku.work account to replace your old default account (so use the same credentials you've been using all along). You ALSO need to upload your new key to heroku: heroku keys:add ~/.ssh/identity.heroku.work.pub
    4. run heroku accounts:add personal --auto to create a new heroku.personal account (eg use your new credentials for your new heroku account). You ALSO need to upload your new key to heroku: heroku keys:add ~/.ssh/identity.heroku.personal.pub
    5. For each app, cd to the project root then run heroku accounts:set work (all that does it setup git to use your heroku.work, which is (unin this example) the same heroku account you've been using all along, only now it's called heroku.work.
    6. If you want to move an app from heroku.work to heroku.personal, (a) add the new heroku account as a collaborator with heroku sharing:add <new owner email> (b) in your local directory, switch the app to heroku.personal using heroku accounts:set personal (c) transfer** the app from the old account to the new account using heroku sharing:transfer <new owner email> then (d) remove the old email address collaborator (if you want to) using heroku sharing:remove <old owner email>

    ** Note the heroku link I provided says there are special requirements to move an app with any paid resources. Generally, remove the paid resoures, then add them back later, or have support do it.

    0 讨论(0)
  • 2020-12-04 05:34

    I started using the heroku-accounts plugin but then realized my buddy could just make me a collaborator on his heroku account and that was all that was needed.

    0 讨论(0)
  • 2020-12-04 05:34

    I have the exact same problem.

    This is not the answer, but a temp solution is to add your "standard" heroku email as a collaborator to the app you can't access.

    0 讨论(0)
  • 2020-12-04 05:39

    You've got to be accepted as a collaborator on the project you don't own.

    It works like this (using git) :

    1. The owner of the project goes to heroku's console for the project
    2. The owner adds the email address of the collaborator (the one that was used to register the collaborator's)
    3. The collaborator sets up his public security key in his account (if he didn't already)
    4. The collaborator adds and sets up the other project as another remote

    And that should be all folks ; you just have to push on the other remote when deploying on the other app.

    0 讨论(0)
  • 2020-12-04 05:39

    I used nano .git/config then replaced value of url of remote "heroku" with heroku.com > apps > settings > Reveal config vars > Heroku Git URL

    0 讨论(0)
  • 2020-12-04 05:40

    To get this to work for me with both Git and the Heroku console, I had to add create the ssh config as instructed by bantic, but I also had to create two remotes to my .git config:

    [remote "origin"]
      url = git@heroku.work:pacific-rock-4904.git
      fetch = +refs/heads/*:refs/remotes/heroku/*
    [remote "heroku"]
      url = git@heroku.com:pacific-rock-4904.git
        fetch = +refs/heads/*:refs/remotes/heroku/*
    
    0 讨论(0)
提交回复
热议问题