我正在尝试将我的仓库回购到我的heroku堆栈,但是每次都会出现此错误:
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/my-heroku-project.git'
这是Python版本3.8.0的完整命令行记录:
Enumerating objects: 36, done.
Counting objects: 100% (36/36), done.
Delta compression using up to 8 threads
Compressing objects: 100% (27/27), done.
Writing objects: 100% (36/36), 4.63 MiB | 923.00 KiB/s, done.
Total 36 (delta 9), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: /app/tmp/buildpacks/8790c95df255b386056ea169648fd4a33d1cb3fba81f73b536f26374f6af107145f64a5980db7a52177f63bb41527f360ebd2e3bef7b8917bda7b51cf284cfdb/bin/steps/python: line 5: warning: command substitution: ignored null byte in input
remote: ! Requested runtime (ÿþPython-3.8.0) is not available for this stack (heroku-18).
remote: ! Aborting. More info: https://devcenter.heroku.com/articles/python-support
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to my-heroku-project.
remote:
To https://git.heroku.com/whatsapp-vertretungsplan-bot.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/my-heroku-project.git'
这是Python版本3.7.5的完整命令行记录:
Enumerating objects: 40, done.
Counting objects: 100% (40/40), done.
Delta compression using up to 8 threads
Compressing objects: 100% (30/30), done.
Writing objects: 100% (40/40), 4.63 MiB | 910.00 KiB/s, done.
Total 40 (delta 11), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: /app/tmp/buildpacks/8790c95df255b386056ea169648fd4a33d1cb3fba81f73b536f26374f6af107145f64a5980db7a52177f63bb41527f360ebd2e3bef7b8917bda7b51cf284cfdb/bin/steps/python: line 5: warning: command substitution: ignored null byte in input
remote: ! Requested runtime (ÿþPython-3.7.5) is not available for this stack (heroku-18).
remote: ! Aborting. More info: https://devcenter.heroku.com/articles/python-support
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to my-heroku-project.
remote:
To https://git.heroku.com/whatsapp-vertretungsplan-bot.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/my-heroku-project.git'
(这是我第一次与Git和Heroku合作。因此,如果错误很明显,对不起。)
答案 0 :(得分:0)
以“ remote:”开头的行被远程存储库中的pre-receive钩子所回显。在接受您的推送之前,远程存储库会运行挂钩以检查文件。它尝试构建/解析文件并遇到错误... 您可以在此处找到完整的答案。 Heroku Deployment Issues ([remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs)。
就我而言,我试图部署flask应用程序,但是缺少包含必需依赖项的文件。为了纠正错误,我这样做是为了生成具有所有依赖项的文件。 “冻结冻结> requirements.txt”,该死!我的问题解决了。
以下博客详细说明了如何在Heroku上部署Flask应用。 https://medium.com/the-andela-way/deploying-a-python-flask-app-to-heroku-41250bda27d0
答案 1 :(得分:0)
如何在runtime.txt文件中编写Python? Python还是python?这个问题发生在我身上:我从Python-3.8.0更改为python-3.8.0,并且可以正常工作。
答案 2 :(得分:0)
查看您的仪表板-> YOUR_APP->活动-> ViewLogs
您可以找到确切的错误消息。
就我而言,我发现了这个(查看图片),我不得不放下我的 package-lock.json ,因为我也有毛线.lock ...
答案 3 :(得分:0)
我发现了问题所在。
我认为Heroku不支持我的编码类型,因此它在我的runtime.txt中添加了一些奇怪的字符。但是在更改为UTF-8(我认为是很久以前)之后,一切正常。
答案 4 :(得分:0)
就我而言,我意识到那已经忘记通过终端登录Heroku了。然后,我更新了requirements.txt
文件。
这就是我所做的:
heroku login
git add .
git commit -m "requirements.txt updates"
git push heroku master.
它按我的预期工作。
答案 5 :(得分:0)
为我工作
第一次
$ heroku config:set DISABLE_COLLECTSTATIC=1
之后
$ git push heroku main
答案 6 :(得分:0)
我通过创建 runtime.txt
文件并将我想要的 Python 版本 (python-3.7.11) 放入此文件中,然后将其放入与 app.py
相同的目录中解决了该问题:
app.py
Procfile
requirements.txt
runtime.txt
答案 7 :(得分:0)
在大多数情况下,只需禁用静态文件配置即可:
heroku config:set DISABLE_COLLECTSTATIC=1
你就可以开始了。