Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
544 views
in Technique[技术] by (71.8m points)

git - Multiple heroku accounts

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. But now (even though I've generated new SSH keys) it wont work.

When I do a git push heroku master it just says:

my@email.com not authorized to access my_app_name

Does anyone have any advice on how I could solve this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You need to ensure that you are using the correct ssh key.

The way to do this (and the way the heroku accounts plugin prompts you) is to add a section to your ssh config file in ~/.ssh/config. For instance, for my work heroku account I have this in my ssh config:

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

Now, and this is crucial, you need to make sure that your git remote is set up to use that same named host. In this case it is heroku.work. Normally it would be heroku.com if you were using heroku with only a single account.

So you'll need to edit the git remote (you can do this in the .git/config file of your repo on your machine). Change the file to look like:

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

Note the heroku.work, not heroku.com, and replace <appname> with the name of your app (aka your repo name) on heroku.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...