【问题标题】:Why is git push heroku <branchname>:main not working?为什么 git push heroku <branchname>:main 不起作用?
【发布时间】:2021-03-19 08:35:24
【问题描述】:

您好,我正在尝试通过 heroku 部署我的烧瓶应用程序。 我一直在关注这个网站:https://devcenter.heroku.com/articles/getting-started-with-python#deploy-the-app

在这个命令之前一切正常:

git push heroku main:main

我收到此错误

(base) name@mac cwesterink.github.io % git push heroku main     
Enumerating objects: 178, done.
Counting objects: 100% (178/178), done.
Delta compression using up to 4 threads
Compressing objects: 100% (97/97), done.
Writing objects: 100% (178/178), 44.11 KiB | 44.11 MiB/s, done.
Total 178 (delta 64), reused 178 (delta 64), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/python.tgz
remote:        More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote: 
remote:  !     Push failed
remote:  !
remote:  ! ## Warning - The same version of this code has already been built: 479f8868ba69f9c7ad9caa5dab5b7bf0b5347d3c
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version 479f8868ba69f9c7ad9caa5dab5b7bf0b5347d3c
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
remote: 
remote: Verifying deploy...
remote: 
remote: !   Push rejected to aqueous-caverns-46845.
remote: 
2020-12-08T04:23:19.788222+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=floating-sierra-24488.herokuapp.com request_id=dd03fcc6-1283-4bc5-8245-af22b4101145 fwd="98.210.226.124" dyno= connect= service= status=503 bytes= protocol=https
2020-12-08T04:23:21.171843+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=floating-sierra-24488.herokuapp.com request_id=02ba31f9-e946-486f-b73e-af635c7ec14d fwd="98.210.226.124" dyno= connect= service= status=503 bytes= protocol=https
2020-12-08T04:27:40.157382+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=floating-sierra-24488.herokuapp.com request_id=a6b20915-6ff6-41ba-9aba-cd421d6f0045 fwd="98.210.226.124" dyno= connect= service= status=503 bytes= protocol=https
2020-12-08T04:27:41.015113+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=floating-sierra-24488.herokuapp.com request_id=9c2b7fb3-49c3-4745-8816-c24363448f49 fwd="98.210.226.124" dyno= connect= service= status=503 bytes= protocol=https```

Any help to solve this problem would be greatly appreciated.

【问题讨论】:

  • “一个常见原因”是推送到非main-or-master 分支。但这不是唯一的原因。你只是一遍又一遍地推动同样的事情吗? before 的构建输出中有什么?这就是有用的东西所在。
  • 在此步骤之前我遇到了另一个错误,所以我重新安装了 brew heroku。这可能是问题吗?有什么方法可以让我从头开始?
  • 这几乎可以肯定是无关紧要的。 再次,您向我们展示的内容上面可能有一些有用的信息。请edit您的问题并在您的构建日志中添加之前的任何内容。
  • 对不起,我对网络应用很陌生。我已经更新了帖子并添加了以前的结果。
  • 它是:“无法检测到此应用程序的默认语言”。您尝试使用什么语言(和框架,如果合适)?

标签: git heroku


【解决方案1】:

如果你知道你在 Heroku 中使用的是 'main' 而不是 'master',你可以通过强制推送来触发重建:

git push heroku main --force

【讨论】:

  • 你确定吗? git push --forceGit 的东西,而不是 Heroku 的东西。将main 分支顶端的任何提交推送到main 分支(a) 不应该需要--force 并且(b) 不应该做任何事情,不管有没有--force。另外,Heroku builds from main or master as of this past July.
  • (另外,任何时候你推荐git push --force,请包含一个警告。这是一个破坏性操作。--force-with-lease 仍然是破坏性的,但它是一个更安全的选择。)
  • Heroku 文档建议强制推送。请参阅devcenter.heroku.com/articles/…...“建议使用 -f(强制标志)以避免与其他开发人员的推送冲突。由于您没有使用 Git 进行修订控制,但仅作为传输,使用强制标志是合理的做法。”
  • 如果你想从特性分支推送,那么强制推送也是唯一的方法,例如git push heroku myfeature:master --force
  • 这是 heroku 的事情,因为 heroku 只跟踪和触发构建在 master 或 main 分支上的最新提交
猜你喜欢
  • 2021-10-19
  • 2011-10-10
  • 2013-06-11
  • 1970-01-01
  • 2021-07-21
  • 2012-11-07
  • 2013-03-10
  • 1970-01-01
  • 2011-01-28
相关资源
最近更新 更多