Heroku:“如果您在分支上进行开发并通过 Git 进行部署,则必须运行”

use*_*745 6 git github heroku

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
Run Code Online (Sandbox Code Playgroud)

提到的文章

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

无论如何,我跑了

git push heroku master:main
Run Code Online (Sandbox Code Playgroud)

按照要求,它发出了警告,但我还是部署了(之前没有这样做git push heroku master)。

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

我不确定这是 Heroku 的一些奇怪问题还是 GitHub 的一些新变化?(我知道他们计划将“master”一词更改为“main” - 我想知道这是否是原因?或者这是否只是对 Heroku 的一些更改,可能只是参考文章上的消息的临时更改?)

use*_*745 5

对我有用的是

git push heroku master:main
Run Code Online (Sandbox Code Playgroud)

这一切都有效(但我不确定为什么这是必要的)。


小智 5

我的合作伙伴:

git push heroku HEAD:master