git Heroku 推送被拒绝

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39267808/
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-19 12:13:51  来源:igfitidea点击:

Heroku push gets rejected

githeroku

提问by Aakash Thakur

I am having problem in pushing my master branch to heroku. I am using the following command:

我在将我的主分支推送到 heroku 时遇到问题。我正在使用以下命令:

git push heroku master

Error that I am encountering-

我遇到的错误-

Counting objects: 114, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (112/112), done.
Writing objects: 100% (114/114), 335.40 KiB | 0 bytes/s, done.
Total 114 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Failed to detect set buildpack https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/php.tgz
remote: More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:

remote: !       Push rejected to skyconfapp.
remote:
To https://git.heroku.com/skyconfapp.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/skyconfapp.git'

I even visited Heroku's link https://devcenter.heroku.com/articles/buildpacks#detection-failureand tried to implement every method that they have mentioned but nothing seems to be working for me.

我什至访问了 Heroku 的链接https://devcenter.heroku.com/articles/buildpacks#detection-failure并尝试实现他们提到的每种方法,但似乎没有任何方法对我有用。

Can someone please assist?

有人可以帮忙吗?

回答by Victor Ferreira

Just happened to me and then I got this working

刚好发生在我身上,然后我开始工作了

Try clearing the buildpacks, adding it again and add/commit/push to heroku

尝试清除 buildpacks,再次添加它并添加/提交/推送到 heroku

heroku buildpacks:clear
heroku buildpacks:set heroku/php
git add/commit/push heroku master

回答by Lemayzeur

I got the same issue, but i fixed by adding "requirements.txt" in the root directory as mentioned here

我遇到了同样的问题,但我通过requirements.txt在根目录中添加“ ”来解决这里提到的问题

The Heroku Support will be applied to applications only when the application has a requirements.txt or Pipfile in the root directory. Even if an application has no module dependencies, it should include an empty requirements.txt or Pipfile to document that your app has no dependencies.

只有当应用程序在根目录中有 requirements.txt 或 Pipfile 时,Heroku 支持才会应用于应用程序。即使应用程序没有模块依赖项,它也应该包含一个空的 requirements.txt 或 Pipfile 来证明您的应用程序没有依赖项。

回答by freeman76

If you are trying to push a nodejs app and you are getting this error, this could be because you are not specifying node version. I was having this error and it was being caused because I was not specifying "engines": { "node: "8.2.1" }

如果您尝试推送 nodejs 应用程序并收到此错误,这可能是因为您没有指定 node 版本。我遇到了这个错误,这是因为我没有指定 "engines": { "node: "8.2.1" }

You can have more details here: https://kb.heroku.com/why-is-my-node-js-build-failing-because-of-an-invalid-semver-requirement

您可以在此处了解更多详细信息:https: //kb.heroku.com/why-is-my-node-js-build-failing-because-of-an-invalid-semver-requirement

回答by Harowitz Black

Late answer. Perhaps it can be helpful for a few.

迟到的答复。也许它对少数人有帮助。

That happened to me when I was pushing a python app. It can be caused if there's an error in naming some file. In my case, it's python and I had misspelled a file name. So, it was unable to detect the build pack. Renaming the file should work I guess.

当我推送一个 python 应用程序时,这发生在我身上。如果在命名某些文件时出现错误,可能会导致它。就我而言,它是 python 并且我拼错了文件名。因此,它无法检测到构建包。我想重命名文件应该可以工作。

回答by Mert Be?iktepe

One cannot push random repos to Heroku without configuring some things in the app's root. For instance, if you want to make a Python app you should include a requirements.txtor setup.pyfile to your app's root. With this, Heroku can decide what kind of assests it needs and configure itself. And you can push successully from here.

如果不在应用程序的根目录中配置一些东西,就无法将随机存储库推送到 Heroku。例如,如果您想制作一个 Python 应用程序,您应该在应用程序的根目录中包含一个requirements.txtsetup.py文件。有了这个,Heroku 可以决定它需要什么样的资产并配置自己。你可以从这里成功推送。

The problem is mostly caused by a un-collectable dependency lib; check your requirements.

该问题主要是由不可收集的依赖库引起的;检查您的要求。

回答by Laurel Thomson

This happened to me when my Node.js app did not follow the buildpack requirements. I had the package.json file in a /server subdirectory, but it needed to be at the root directory. Once I moved all my server files into the root directory, heroku was able to determine the correct buildpack and I was able to push to my heroku app.

当我的 Node.js 应用程序不遵循 buildpack 要求时,这发生在我身上。我在 /server 子目录中有 package.json 文件,但它需要位于根目录中。一旦我将所有服务器文件移动到根目录中,heroku 就能够确定正确的 buildpack,并且我能够推送到我的 heroku 应用程序。

回答by Carlos Vallejo

Sometimes this is caused because when you create your frontend application, it also initialize git automatically.

有时这是因为当您创建前端应用程序时,它也会自动初始化 git。

First, you have to delte .gitfolder inside you clientFolderfolder

首先,您必须.gitclientFolder文件夹中删除文件夹

Then, run the next code to delete the git submodule cache

然后,运行下一段代码删除git子模块缓存

git rm -f --cached clientFolder

Then just make an add and a commit to your repository

然后只需添加并提交到您的存储库

git add .
git commit -am 'Adding clientFolder to the main git repository'

Now you can run:

现在你可以运行:

git push heroku master

Hope this would help someone.

希望这会帮助某人。

回答by Derrell Durrett

I encountered this issue in Rails when I failed to run bundle installafter removing a meaningless gem from my Gemfile. Consequently, Gemfile.lockwas mismatched, and Heroku rejected the push.

我在 Rails 中遇到了这个问题,当时我bundle install从我的Gemfile. 因此,Gemfile.lock不匹配,Heroku 拒绝了推送。