IT story

여러 헤 로쿠 계정

hot-time 2020. 9. 2. 20:39
반응형

여러 헤 로쿠 계정


내 컴퓨터에서 여러 Heroku 계정으로 작업 할 때 문제가 있습니다.

문제는 heroku gem으로 계정을 전환하여 이전에 훌륭하게 작동했다는 것입니다. 하지만 지금은 (새 SSH 키를 생성했지만) 작동하지 않습니다.

내가 할 때 git push heroku master다음과 같이 말합니다.

my@email.com이 my_app_name에 액세스 할 권한이 없습니다.

누구든지 내가 이것을 해결할 수있는 방법에 대한 조언이 있습니까?


올바른 ssh 키를 사용하고 있는지 확인해야합니다.

이를 수행하는 방법 (그리고 heroku 계정 플러그인이 프롬프트하는 방법)은 ~ / .ssh / config의 ssh 구성 파일에 섹션을 추가하는 것입니다. 예를 들어, 내 작업 heroku 계정의 경우 ssh 구성에 다음이 있습니다.

Host heroku.work
  HostName heroku.com
  IdentityFile ~/.ssh/id_heroku_work_rsa
  IdentitiesOnly yes

이제 이것은 매우 중요합니다. git remote가 동일한 이름의 host 를 사용 하도록 설정되어 있는지 확인해야합니다 . 이 경우 heroku.work 입니다. 일반적으로 단일 계정으로 heroku를 사용하는 경우에는 heroku.com이됩니다.

따라서 git remote를 편집해야 .git/config합니다 (머신의 저장소 파일 에서이 작업을 수행 할 수 있습니다 ). 파일을 다음과 같이 변경하십시오.

 [remote "heroku"]
   url = git@heroku.work:<appname>.git

heroku에 유의하십시오. 헤 로쿠가 아니라 . com 을 입력하고 <appname>을 heroku의 앱 이름 (일명 repo 이름)으로 바꿉니다.


heroku-accounts 플러그인을 사용하여이 문제를 해결했습니다.

지침은 여기를 참조하십시오.

http://martyhaught.com/articles/2010/12/14/managing-multiple-heroku-accounts/


자신이 소유하지 않은 프로젝트의 공동 작업자로 인정 받아야합니다.

다음과 같이 작동합니다 (git 사용).

  1. 프로젝트 소유자는 프로젝트의 heroku 콘솔로 이동합니다.
  2. 소유자는 공동 작업자의 이메일 주소 (공동 작업자의 등록에 사용 된 주소)를 추가합니다.
  3. 공동 작업자가 자신의 계정에 공개 보안 키를 설정합니다 (아직 설정하지 않은 경우).
  4. 공동 작업자는 다른 프로젝트를 다른 원격으로 추가하고 설정합니다.

그리고 그것은 모든 사람들이어야합니다; 다른 앱에 배포 할 때 다른 리모컨을 푸시하면됩니다.


heroku-accounts 플러그인에 몇 가지를 추가하겠습니다 .이 예제에서는 기존 heroku 계정이 heroku.work이고 새 계정 heroku.personal을 추가한다고 가정합니다.

또한 앱을 한 앱에서 다른 앱으로 이동하는 방법을 설명합니다. 예를 들어 앱 최대 값이 25 개에 도달하고 새 계정을 만들고 일부 프로젝트 및 실험용 앱을 기본 계정에서 이동하려는 경우입니다.

  1. 이전 계정과 새 계정을 모두 만들려면 플러그인을 사용해야 할 것입니다. 예를 들어 처음 시작할 계정이있는 경우 새 heroku.personal을 추가 할 수없는 경우 이전 계정을 대체하기 위해 heroku.work를 만들어야합니다.
  2. 이전 앱을 heroku.work에 다시 할당해야합니다.
  3. 당신이 경우 이동 응용 프로그램을, heroku.personal (사용하여 응용 프로그램을 지정하지 않은 heroku accounts:set personal때까지) 당신이에게 Heroku를 사용하여 응용 프로그램을 전송하는 sharing기술로 Section 명령을 https://devcenter.heroku.com/articles/transferring-apps

따라서 필요한 단계는 다음과 같습니다.

  1. heroku-account 플러그인 설치
  2. heroku.com으로 이동하여 새 계정을 만듭니다 (아직 두 번째 계정이없는 경우).
  3. 실행 heroku accounts:add work --auto하여 새 heroku.work 계정을 만들어 이전 기본 계정을 대체하십시오 (그러므로 함께 사용했던 것과 동일한 자격 증명을 사용하십시오). 또한 새 키를 heroku에 업로드해야합니다.heroku keys:add ~/.ssh/identity.heroku.work.pub
  4. 실행 heroku accounts:add personal --auto하여 새 heroku.personal 계정을 만듭니다 (예 : 새 heroku 계정에 대해 새 자격 증명 사용). 또한 새 키를 heroku에 업로드해야합니다.heroku keys:add ~/.ssh/identity.heroku.personal.pub
  5. 각 앱에 대해 프로젝트 루트로 cd 한 다음 실행합니다 heroku accounts:set work(이 모든 작업은 heroku.work를 사용하도록 git을 설정합니다.이 예제에서는 사용했던 것과 동일한 heroku 계정이 지금 만 heroku라고합니다). 작업.
  6. heroku.work에서 heroku.personal로 앱을 이동하려면 heroku sharing:add <new owner email>(a) 로컬 디렉토리에서 (b) 와 함께 새 heroku 계정을 공동 작업자로 추가하고 heroku accounts:set personal(c) transfer **를 사용하여 앱을 heroku.personal로 전환합니다. 다음을 사용하여 이전 계정에서 새 계정으로 앱을 heroku sharing:transfer <new owner email>만든 다음 (d) 이전 이메일 주소 공동 작업자를 제거합니다 (원하는 경우).heroku sharing:remove <old owner email>

** 내가 제공 한 heroku 링크에는 유료 리소스로 앱을 이동하는 데 특별한 요구 사항이 있다고 나와 있습니다. 일반적으로 유료 리소스를 제거한 다음 나중에 다시 추가하거나 지원을 받으십시오.


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


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.


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/*

This has been bugging me for a while, and I never found a solution that I liked. Finally found one.

(OS X specific answer.)

You can just create new users. Go to System Preferences -> Users & Groups -> Add user or group button. You can create a few users for different heroku accounts, I just named mine user1, user2, etc.

Then go to System Preferences -> Sharing -> Remote Login -> Allow access for: All Users

At this point, you can go to a terminal and do the following:

$ ssh user1@localhost

Then you can do things like this:

$ heroku login
$ heroku keys:add

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


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.


i am using win7

1) create another user account in win7 and log into it

2) open git bash and log into your new heroku account

3) create and upload new RSA key (instruction here : https://devcenter.heroku.com/articles/keys)

4) then do what ever you want (create new app, push file to it .....)

5) every time you need to work with your original heroku account just log into your original win user account and work with heroku


create new public/private key for new email as follows

1) ssh-keygen -t rsa -C "mvjohn@klairvoynat.com"

2) provide new file name in which to save the key (/home/.ssh/seckey)

3) Then add your new key to the ssh-agent:- ssh-add ~/.ssh/seckey

4) Then add your new key to heroku :- heroku keys:add ~/.ssh/seckey

5) add SSH Config File as ~/.ssh/config and content as follows

Host heroku.com Hostname heroku.com Port 22 IdentitiesOnly yes IdentityFile ~/.ssh/seckey User mvjohn@klairvoynat.com

Host heroku.com Hostname heroku.com Port 22 IdentitiesOnly yes IdentityFile ~/.ssh/id_rsa User mvjohn@hotmail.com

6) clone the code using either

a) git clone git@heroku.com:your-application.git b) heroku git:clone -a your-application


Edit your config for that project, setting the correct email. From the root of that repository, git config user.email <heroku email>

참고URL : https://stackoverflow.com/questions/4663103/multiple-heroku-accounts

반응형