git 无法推送到heroku

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38841284/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 04:28:01  来源:igfitidea点击:

Can't push to the heroku

gitscalaherokuintellij-idea

提问by ???

I was pushing the current git repository into the heroku. That online application was developed using Scala and IntelliJ. And I don't know how to fix this error.

我正在将当前的 git 存储库推送到 heroku。该在线应用程序是使用 Scala 和 IntelliJ 开发的。我不知道如何解决这个错误。

$ git push heroku master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 531 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote:  !     No default language could be detected for this app.
remote:             HINT: This occurs when Heroku cannot detect the         buildpack to use for this application automatically.
remote:             See https://devcenter.heroku.com/articles/buildpacks
remote: 
remote:  !     Push failed
remote: Verifying deploy....
remote: 
remote: !   Push rejected to salty-coast-14102.
remote: 
To https://git.heroku.com/salty-coast-14102.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/salty-coast-14102.git'

回答by CodeWizard

Read this doc which will explain to you what to do.
https://devcenter.heroku.com/articles/buildpacks

阅读此文档,它将向您解释要做什么。
https://devcenter.heroku.com/articles/buildpacks

Setting a buildpack on an application

You can change the buildpack used by an application by setting the buildpack value.
When the application is next pushed, the new buildpack will be used.

$ heroku buildpacks:set heroku/php

Buildpack set. Next release on random-app-1234 will use heroku/php.
Run git push heroku masterto create a new release using this buildpack.

在应用程序上设置 buildpack

您可以通过设置 buildpack 值来更改应用程序使用的 buildpack。
下次推送应用程序时,将使用新的 buildpack。

$ heroku buildpacks:set heroku/php

构建包集。random-app-1234 上的下一个版本将使用 heroku/php。
运行git push heroku master以使用此构建包创建新版本。

This is whay its not working for you since you did not set it up.

这就是为什么它不适合你,因为你没有设置它。

... When the application is next pushed, the new buildpack will be used.

... 下次推送应用程序时,将使用新的 buildpack。

You may also specify a buildpack during app creation:

You may also specify a buildpack during app creation

$ heroku create myapp --buildpack heroku/python

回答by CiscoKidx

There has to be a .gitdirectory in the root of your project.

.git项目的根目录中必须有一个目录。

If you don't see that directory run git initand then re-associate your remote.

如果您没有看到该目录运行git init,然后重新关联您的遥控器。

Like so:

像这样:

heroku git:remote -a herokuAppName
git push heroku master

回答by geekbro

Make sure you have package.jsoninside root of your project. Happy coding :)

确保您有package.json项目的根目录。快乐编码:)

回答by markroxor

If you are a pythonuser -
Create a requirements.txtfile preferably using pip freeze > requirements.txt.
Add, commit and try pushing it again.

如果你是一个python用户-
创建一个requirements.txt文件,最好使用pip freeze > requirements.txt
添加、提交并再次尝试推送。

If this doesn't work try deleting .git(beware this might remove the associated git history) and follow the above steps again.

如果这不起作用,请尝试删除.git(请注意这可能会删除关联的 git 历史记录)并再次执行上述步骤。

Worked for me.

对我来说有效。

回答by codefinger

If your app is a Scala app, it must have a build.sbtin the root directory, and that file must be checked into Git. You can confirm this by running:

如果您的应用程序是 Scala 应用程序,则它build.sbt的根目录中必须有,并且必须将该文件签入 Git。您可以通过运行来确认这一点:

$ git ls-files build.sbt

If that file exists and is checked into Git, try running this command:

如果该文件存在并已签入 Git,请尝试运行以下命令:

$ heroku buildpacks:set heroku/scala

回答by Vikas Sharma

Specify the buildpack while creating the app.

在创建应用程序时指定 buildpack。

heroku create appname --buildpack heroku/python

回答by ChaitanyaBhatt

You could also select webpack build manually from the UI enter image description here

您也可以从 UI 中手动选择 webpack build 在此处输入图片说明

回答by Mohsin Mahmood

If you are using django app to deploy on heroku

如果您使用 django 应用程序在 heroku 上进行部署

make sure to put requestlibrary in the requirements.txt file.

确保将请求库放在 requirements.txt 文件中。

回答by iQhry

You need to follow the instructions displayed here, on your case follow scala configuration:

您需要按照此处显示的说明进行操作,在您的情况下,请遵循 Scala 配置:

https://devcenter.heroku.com/articles/getting-started-with-scala#introduction

https://devcenter.heroku.com/articles/getting-started-with-scala#introduction

After setting up the getting started pack, tweak around the default config and apply to your local repository. It should work, just like mine using NodeJS.

设置入门包后,调整默认配置并应用于您的本地存储库。它应该可以工作,就像我使用 NodeJS 一样。

HTH! :)

哼!:)