【问题标题】:Heroku: "If you are developing on a branch and deploying via Git you must run"Heroku:如果你在一个分支上开发并通过 git 部署,你必须运行:
【发布时间】:2021-01-23 16:01:58
【问题描述】:

Heroku 认为我在“不同的分支”上,但我不是(而且代码的相同版本肯定没有像声称的那样“被构建”):

remote:  ! ## Warning - The same version of this code has already been built: e437cb472232ed140fa6dd710e8b4a6b16b8b213
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version e437cb472232ec180fa6dd700e8b4a6b1ab8b213
remote:  ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote:  !
remote:  ! If you are developing on a branch and deploying via git you must run:
remote:  !
remote:  !     git push heroku <branchname>:main
remote:  !
remote:  ! This article goes into details on the behavior:
remote:  !   https://devcenter.heroku.com/articles/duplicate-build-version

mentioned article

本文正在进行中,或记录尚未向所有用户发布的功能。这篇文章是未列出的。只有知道链接的人才能访问它。

无论如何,我跑了

git push heroku master:main

根据要求,它发出了警告,但无论如何都已部署(以前使用 git push heroku master 时没有这样做)。

已部署的应用程序,这意味着问题已解决。但是我很困惑这里发生了什么导致应用程序在没有上面的特殊命令的情况下无法部署。

我不确定这是 heroku 的一些奇怪问题,还是 github 的一些新变化? (我知道他们打算将“master”这个词改为“main”——我想知道这是否是原因?或者这只是对 heroku 的一些更改,可能只是参考文章中的信息的临时更改?)

【问题讨论】:

    标签: git github heroku


    【解决方案1】:

    对我有用的是

    git push heroku master:main
    

    这一切都奏效了

    (不知道为什么这是必要的)

    【讨论】:

      【解决方案2】:

      我的合作伙伴:

      git push heroku HEAD:master

      【讨论】:

        【解决方案3】:

        这个解决方案对我有用:

        添加并签出新分支

        git checkout -b tes
        

        并将其推送到上面的分支

        git push heroku tes
        

        【讨论】:

          【解决方案4】:

          只是想补充一点,我需要先运行git add,然后再运行git commit,然后才能运行

          git push heroku master
          

          【讨论】:

          • 您能否详细说明这对您有何帮助?根据问题,我可以清楚地看到用户必须将代码推送到远程主分支,而您的 git 命令不会这样做。那么,您能否验证并更正您的答案
          猜你喜欢
          • 1970-01-01
          • 2020-09-17
          • 2019-07-01
          • 2020-02-18
          • 2015-12-10
          • 1970-01-01
          • 2011-09-02
          • 1970-01-01
          • 2015-09-17
          相关资源
          最近更新 更多