如何在heroku CLI中避免--app选项? [英] How to avoid the --app option with heroku CLI?

查看:112
本文介绍了如何在heroku CLI中避免--app选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次在终端中运行heroku命令时,我都厌倦了输入应用程序名称:

I'm tired of entering the name of my app each time I run a heroku command in the terminal:

heroku run rake db:migrate --app myapp
heroku run rake db:seed --app myapp
heroku run rake sth:else --app myapp

--app非常多余且令人讨厌,我不知道在项目中全局一次进行配置的选项.

The --app is very redundant and annoying, I didn't figured out where were the option to configure it globally once for the project.

推荐答案

heroku在知道应该与哪个应用程序通信时不需要--app参数.当只有一个Git远程指向某个存储库的Heroku时,就会发生这种情况.

heroku doesn't require the --app argument when it knows which app it should talk to. This occurs when there is exactly one Git remote pointing to Heroku for a repository.

您似乎没有任何指向Heroku的遥控器.运行

You don't appear to have any remotes pointing to Heroku. Run

heroku git:remote --app myapp

添加添加.完成后,您应该可以忽略该特定存储库上heroku命令的--app参数.

to add such a remote. Once that's done you should be able to omit the --app argument for heroku commands on that particular repository.

如果您愿意自己做,则可以运行

If you prefer to do this yourself you can run

git remote add heroku git@heroku.com:myapp.git

请注意,可能有多个 Heroku遥控器,例如如果您有演出和生产应用程序.在这种情况下,您还必须提供--app参数来指定应使用哪个参数.

Note that it's possible to have multiple Heroku remotes, e.g. if you have a staging and a production app. In this case you will also have to provide the --app argument to specify which one should be used.

这篇关于如何在heroku CLI中避免--app选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆