如何设置heroku工具栏使用-r<昵称>指定一个应用程序 [英] how setup heroku toolbelt to use -r <nickname> to specify an app
问题描述
在我的旧机器上,我可以输入
heroku config -r prod
查看应用程序昵称为'prod'的配置设置(而不是--app actual_app_name)。
在我的新机器上,使用相同版本的heroku工具栏,我不记得如何告诉heroku toolbet接受 -r prodn
而不是 - app actual_app_name
两台机器上的git配置文件似乎相同,所以它不是git confgi设置。 。
2014年12月更新
andorov 提及中的r-nickname-to-specify-an-app / 26814985?noredirect = 1#comment43302923_26814985>宣布 HTTP Git现在一般可用:
现在默认使用HTTP Git,
heroku创建
,heroku git:remote
和heroku git:clone
环境来使用HTTP Git。
如果出于任何原因想要将SSH Git与特定应用程序一起使用,只需传递- ssh-git
flag这些命令,例如:
$ heroku create --ssh-git
如果您想在特定机器上始终使用SSH Git和Heroku,那么您可以添加以下全局配置:
git config --global url.ssh:// git@heroku.com/.insteadOf https://git.heroku.com/
HTTP URL仍将写入
.git
文件夹,但Git会即时重写所有Heroku HTTP Git URL以使用SSH。
见Git文档了解详细信息,包括如何删除此设置的说明。
原始答案(Nov. 2014)
文章 This Week I Learned#2 提及:
使用Heroku Toolbelt,您可以通过 Git Remote 识别应用程序而不是名称
这意味着-r后跟远程名称,由 git remote -v
。
因此,请检查您的本地远程 git remote -v
,然后尝试使用该名称(引用远程回购
看到项目示例:
创建Heroku应用程序回购并添加Git staging remote,
heroku login#如果您没有alr eady
heroku create --remote staging#在项目目录中
heroku create --remote production
git remote -v#expect:原始,暂存,制作
$ c $这个项目与两个Heroku应用程序相关联,一个用于暂存,另一个用于生产。
当git推送时,指定正确的远程端口,并在使用heroku命令时,使用 - 远程远程名称
或 -r远程名称 options来指定部署应用程序的应用程序。
要告诉heroku命令默认为此项目的分段,
git config heroku.remote staging
On my old machine I could type
heroku config -r prod
to see the config settings for the app nicknamed 'prod' (instead of --app actual_app_name).
On my new machine, with the same version of heroku toolbelt, I cannot recall how to tell heroku toolbet to accept -r prodn
instead of --app actual_app_name
The git config files on the two machines seem to be the same, so it's not a git confgi setting...
解决方案 Update Dec. 2014
andorov mentions in the comments to the Heroku announce "HTTP Git now Generally Available":
With HTTP Git now the default, heroku create
, heroku git:remote
and heroku git:clone
commands all configure your local environment to use HTTP Git.
If, for any reason, you want to use SSH Git with a particular app, simply pass a --ssh-git
flag to these commands, e.g.:
$ heroku create --ssh-git
If you want to always use SSH Git with Heroku on a particular machine, you can add the following global config:
git config --global url.ssh://git@heroku.com/.insteadOf https://git.heroku.com/
HTTP URLs will still be written to .git
folders but Git will rewrite, on the fly, all Heroku HTTP Git URLs to use SSH.
See the Git documentation for details for details, including instructions on how to remove this setting.
Original Answer (Nov. 2014)
The article "This Week I Learned #2" mentions:
With the Heroku Toolbelt You Can Identify Apps by Git Remote Instead of Name
That would mean the -r is followed by the name of a remote, one returned by git remote -v
.
So check your local remote git remote -v
, and try using that name (referencing the remote repo where your heroku app is pushed).
See that project example:
Create Heroku app repo and add Git staging remote,
heroku login # if you haven't already
heroku create --remote staging # within project dir
heroku create --remote production
git remote -v # expect: origin, staging, production
Here the project becomes associated with two Heroku apps, one for staging and another for production.
When git pushing, specify the correct remote and when using heroku commands use the --remote remote-name
or -r remote-name
options to specify the application to which deployments should go.
To tell the heroku command to default to staging for this project,
git config heroku.remote staging
这篇关于如何设置heroku工具栏使用-r<昵称>指定一个应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!