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

6

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

该文章提到:

这篇文章仍在制作中,或记录了尚未向所有用户发布的功能。 这篇文章未列出。 只有具有链接的人才能访问它。

无论如何,我运行了

git push heroku master:main

如您所请求的,它发出了警告,但我还是部署了(这在以前用git push heroku master时是不会发生的)。

应用程序已部署,这意味着问题已解决。但我不确定导致应用程序无法在没有上述特殊命令的情况下部署的原因是什么。

我不确定这是否是Heroku的一些奇怪问题,或者是GitHub的新变化?(我知道他们计划将单词“master”更改为“main”——我想知道这是否是原因?或者这只是对Heroku进行的一些更改,可能是基于引用文章中的消息而做的暂时性更改?)

4个回答

5

我的工作涉及:

git push heroku HEAD:master


5

我自己的经验是

git push heroku master:main

而这一切都运作良好(虽然我不确定为什么需要这样做)。


2
这个方案对我很有用:
添加并检出一个新分支。
git checkout -b tes

将其推送到上面的分支:
git push heroku tes

0

我只想补充一下,在继续之前,我需要运行git addgit commit,然后它就可以工作了。

git push heroku master

你能否详细说明一下这对你是如何起作用的?根据问题,我可以清楚地看到用户必须将代码推送到远程主分支,而你的git命令不会这样做。所以,请验证并更正你的答案。 - Pratap Alok Raj

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接