多个heroku帐户 [英] Multiple heroku accounts
问题描述
问题在于,它通过使用heroku gem切换账户非常有效。但现在(即使我已经生成了新的SSH密钥)它不会工作。
当我做一个 git push heroku master
它只是说:
my@email.com无权访问my_app_name
有没有人对我如何解决这个问题有任何建议? 需要确保您使用的是正确的ssh密钥。
执行此操作的方法(以及heroku帐户插件提示您的方式)是向您的〜/ .ssh / config中的ssh配置文件。例如,对于我的作品heroku帐户,我有这在我的SSH配置:
主机heroku.work
HostName heroku .com
IdentityFile〜/ .ssh / id_heroku_work_rsa
IdentitiesOnly yes
现在,这是至关重要的,你需要确保你的git远程被设置为使用同一个命名主机。在这种情况下,它是 heroku.work 。通常情况下,如果您只使用一个账户使用heroku,那么它就是heroku.com。
所以你需要编辑git remote(你可以在 .git / config
您机器上的回购文件)。将文件更改为:
[remoteheroku]
url = git@heroku.work:< ; appname> .git
注意heroku。工作,而不是heroku。 com ,然后替换< appname>与您的应用程序的名称(又名您的回购名称)在heroku上。
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?
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.
这篇关于多个heroku帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!