【问题标题】:How do I use --remote in place of --app for Heroku CLI commands?如何使用 --remote 代替 --app 来执行 Heroku CLI 命令?
【发布时间】:2013-04-09 15:31:44
【问题描述】:

我通常将 --app 标志用于多个应用程序,但最近发现了 --remote。我更喜欢更通用的 --remote 但一直无法让它工作。

“git remote”列出了原始、暂存和生产,但运行,例如,“heroku logs --remote staging”会产生“未指定应用程序”错误。

在 Heroku irc 频道中有人告诉我,这应该可以工作,并且可以使用 --remote 代替 --app。我错过了什么?

heroku-toolbelt v. 2.37.2。谢谢。

【问题讨论】:

    标签: heroku heroku-toolbelt


    【解决方案1】:

    这可能是您的 git 遥控器未正确设置以匹配 regex in Toolbelt 的问题。要查看遥控器的详细信息,请运行:

    git remote -v
    

    这应该给你这样的东西:

    dev     git@heroku.com:example-dev-ryan.git (push)
    dev     git@heroku.com:example-dev-ryan.git (fetch)
    origin  git@github.com:ryanbrainard/example.git (fetch)
    origin  git@github.com:ryanbrainard/example.git (push)
    prod    git@heroku.com:example.git (push)
    prod    git@heroku.com:example.git (fetch)
    staging git@heroku.com:example-staging.git (fetch)
    staging git@heroku.com:example-staging.git (push)
    

    确保您的 Heroku git 遥控器匹配 pattern:

    ^git@#{Heroku::Auth.git_host}(?:[\.\w]*):([\w\d-]+)\.git$
    

    其中#{Heroku::Auth.git_host} 等于heroku.com,除非您在~/.ssh/config 中覆盖它。

    然后你就可以使用--remote(或简称-r),像这样:

    heroku info --remote prod
    

    【讨论】:

    • 这就是问题所在。我更改了主机名以匹配 ~/.ssh/config 中的工作 ssh 密钥,因此 Heroku::Auth.git_host 在正则表达式中不匹配。
    • 很高兴听到。我刚刚更新了我的答案以调用 ~/.ssh/config 覆盖。
    猜你喜欢
    • 2020-04-20
    • 1970-01-01
    • 2019-12-04
    • 2021-10-08
    • 2012-06-05
    • 2017-05-11
    • 2018-03-10
    • 2022-01-21
    • 1970-01-01
    相关资源
    最近更新 更多