ruby git,Heroku:预接收钩子被拒绝

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

git, Heroku: pre-receive hook declined

rubygitherokurack

提问by wuliwong

I am in the process of setting up a git repository and attempting to link it to Heroku. When I run the command

我正在设置 git 存储库并尝试将其链接到 Heroku。当我运行命令时

git push heroku master

I receive

我收到

Counting objects: 7, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (7/7), 714 bytes, done.
Total 7 (delta 1), reused 0 (delta 0)

-----> Heroku receiving push

 !     Heroku push rejected due to an unrecognized error.
 !     We've been notified, see http://support.heroku.com if the problem persists.


To [email protected]:morning-stream-3712.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:morning-stream-3712.git'

I'm not quite sure what other information would be helpful and what will just muddy the waters, so I'll just leave it at this for now. Any help getting my application pushed to Heroku would be greatly appreciated. Thanks.

我不太确定还有哪些其他信息会有所帮助,哪些信息只会让水变得混乱,所以我现在就先把它留在这儿。将我的应用程序推送到 Heroku 的任何帮助将不胜感激。谢谢。

采纳答案by manojlds

Make sure you are pushing a repo that contains a proper supported app ( Rails, Django etc.) and you are not just pushing some random repo to test it out.

确保您正在推送一个包含适当支持的应用程序(Rails、Django 等)的存储库,而不仅仅是推送一些随机存储库来测试它。

Newbie in Heroku: Error when push my app to Heroku

Heroku 新手:将我的应用程序推送到 Heroku 时出错

If that is not the case and you are pushing what you think is a valid app, contact Heroku support and they will fix it for you.

如果情况并非如此,并且您正在推送您认为有效的应用程序,请联系 Heroku 支持,他们会为您修复。

回答by Avi Alima

I faced the same problem:

我遇到了同样的问题:

! [remote rejected] vX.X.XX -> master (pre-receive hook declined) 
error: failed to push some refs to '[email protected]:[application-name]'

I realized that my heroku application Stack is 'cedar-10' and was deprecated from 04/11/2014 and disabled from 04/11/2015 (Cedar-14 is now Generally Available).

我意识到我的 heroku 应用程序堆栈是“cedar-10”,从 2014 年4 月 11 日起被弃用,从 2015 年4 月 11 日起禁用(Cedar-14 现在普遍可用)。

The solution was to upgrade the heroku application Stack following the guide:

解决方案是按照指南升级 heroku 应用程序堆栈:

Upgrading the production app to Cedar-14

将生产应用程序升级到 Cedar-14

回答by beckah

Another issue could be that in a production environment, you can't use sqlite3, the default database when you make a rails app.

另一个问题可能是在生产环境中,您不能使用 sqlite3,这是您制作 rails 应用程序时的默认数据库。

In order to fix this, just change the database your rails app uses to Postgres. This can easily be accomplished by editing your Gemfile

为了解决这个问题,只需将您的 rails 应用程序使用的数据库更改为 Postgres。这可以通过编辑您的 Gemfile轻松完成

From your Gemfile, remove:

从您的 Gemfile 中删除:

gem sqlite3;

and add the following:

并添加以下内容:

group :development, :test do
  gem 'sqlite3'
end

group :production do
  gem 'pg'
end

回答by Rajat Verma

Make sure that you are using either npm or yarn.lock file-

确保您使用的是 npm 或 yarn.lock 文件-

Two different lockfiles found: package-lock.json and yarn.lock Both npm and yarn have created lockfiles for this application, but only one can be used to install dependencies.

找到两个不同的锁文件:package-lock.json 和yarn.lock npm 和yarn 都为这个应用程序创建了锁文件,但只有一个可以用来安装依赖项。

After deleting yarn.lock and pushing the code again to git, my issue resolved.

删除 yarn.lock 并将代码再次推送到 git 后,我​​的问题解决了。

回答by Mohamed Turki

I had the same problem but with a Django app, it turned out that pip wasn't able to download/install one of the dependencies of the requirements.txt file (it was eyeD3)

我遇到了同样的问题,但是使用 Django 应用程序时,结果发现 pip 无法下载/安装 requirements.txt 文件的依赖项之一(它是 eyeD3)

回答by Jeff L

In case someone makes the same dumb mistake I did...

万一有人犯了和我一样愚蠢的错误......

If you have an error in your css this error can also show up.

如果你的 css 有错误,这个错误也会出现。

In one of my media queries I put

在我的一个媒体查询中,我提出

@media screen adn (min-width: 1000px) {

Instead of the "and" which gave me this error.

而不是给我这个错误的“和”。

A good indicator that this may be the case is if you get an error that contains the message

如果您收到包含消息的错误,则可能是这种情况的一个很好的指标

"Tasks: TOP => assets:precompile ... Precompiling assets failed" 

That was my first clue to look in my css.

那是我查看 css 的第一个线索。

Hope this helps someone!

希望这可以帮助某人!

回答by Mon

A little late to the game, one of my issues was I had an outdated sshkey. Just need to update that in the settings.

游戏有点晚了,我的问题之一是我有一个过时的sshkey。只需要在设置中更新即可。

Another thing was I was pushing Python Django CMS, and it was running python manage.py collectstaticduring deploy and it was failing. So make sure you check the log heroku logs --tail. That gave me another hint to turn off collectstatic, it event tells you what to type to turn it off.

另一件事是我正在推动 Python Django CMS,它python manage.py collectstatic在部署期间运行并且失败了。所以一定要检查日志heroku logs --tail。这给了我关闭的另一个提示collectstatic,它事件告诉你输入什么来关闭它。

回答by Bhagvat Lande

i thought , this will not be the error occured due to any app , or code changes. i have same problem now this happen due to the following reason:

我想,这不会是由于任何应用程序或代码更改而发生的错误。我现在遇到同样的问题,这是由于以下原因:

  • 1) i have code on bitbucket/git i push the code to repository (this repo is linked with the heroku app,meanse changes to this will reflects on heroku)
  • 2)after pushing code to repo , i am trying to push code on heroku with "git push heroku master" but due to some reason i abort this command, thats why code is not pushed to heroku

  • 3)then i am agian triyng to push code to heroku it says same error
    as above

  • 4) the solution for this is "just pull yours last commited code" and push the changes to heroku ..thats it thanks
  • 1)我在 bitbucket/git 上有代码,我将代码推送到存储库(此存储库与 heroku 应用程序链接,意味着对此的更改将反映在 heroku 上)
  • 2)在将代码推送到 repo 之后,我试图用“git push heroku master”在 heroku 上推送代码,但由于某种原因我中止了这个命令,这就是为什么代码没有推送到 heroku

  • 3)然后我再次尝试将代码推送到heroku它说与
    上面相同的错误

  • 4)对此的解决方案是“只需提取您最后提交的代码”并将更改推送到heroku ..谢谢

回答by barlop

I had this with a sinatra application. (Heroku does support Sinatra).

我有一个 sinatra 应用程序。(Heroku 确实支持 Sinatra)。

The instructions on the heroku blog post were incomplete

heroku 博客文章中的说明不完整

https://blog.heroku.com/32_deploy_merb_sinatra_or_any_rack_app_to_heroku

https://blog.heroku.com/32_deploy_merb_sinatra_or_any_rack_app_to_heroku

My program ran fine locally but I got that error when trying to push to heroku.

我的程序在本地运行良好,但是在尝试推送到 heroku 时出现了该错误。

The heroku blogpost didn't include the need to make a gemfile and do bundle install. The program was running locally fine, but to make it work on heroku it needed a Gemfile and bundle install on it.

heroku 博客文章不包括制作 gemfile 和进行捆绑安装的需要。该程序在本地运行良好,但要使其在 heroku 上运行,它需要一个 Gemfile 并在其上安装包。

this link here https://teamtreehouse.com/community/how-can-i-make-my-sinatra-app-publicmentioned that I needed a Gemfile, and mentioned the contents of the Gemfile. And then to do bundle install. Then once that is done, then follow the instructions on that heroku blog post, of making the program file, and the config.ru and the git repo and doing heroku create (which also creates the remote), then git push heroku master.

这个链接https://teamtreehouse.com/community/how-can-i-make-my-sinatra-app-public提到我需要一个 Gemfile,并提到了 Gemfile 的内容。然后做捆绑安装。然后一旦完成,然后按照 heroku 博客文章中的说明制作程序文件、config.ru 和 git repo 并执行 heroku create(这也创建远程),然后 git push heroku master。

i.e.

IE

Gemfile as mentioned at treehouse link

树屋链接中提到的 Gemfile

# define our source to look for gems
source "http://rubygems.org/"

# declare the sinatra dependency
gem "sinatra" 

And bundle install to install that Gemfile.

并捆绑安装以安装该 Gemfile。

bundle install

hello.rb (as mentioned on heroku blogpost)

hello.rb(如heroku blogpost所述)

require 'rubygems'
require 'sinatra'

get '/' do
  "Hello from Sinatra on Heroku!"
end

config.ru

配置文件

require './hello'
run Sinatra::Application

git

混帐

$ git init
Initialized empty Git repository in /Users/adam/hello/.git/
$ git add .
$ git commit -m "sinatra and heroku, two great tastes"
[master (root-commit)]: created 93a9e6d: "sinatra and heroku, two great tastes"
 2 files changed, 9 insertions(+), 0 deletions(-)
 create mode 100644 config.ru
 create mode 100644 hello.rb

heroku create

heroku 创建

$ heroku create
Created http://severe-spring-77.heroku.com/ | [email protected]:severe-spring-77.git
Git remote heroku added

the push to heroku

推向 heroku

$ git push heroku master
Counting objects: 4, done.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 385 bytes, done.
Total 4 (delta 0), reused 0 (delta 0)

-----> Heroku receiving push
-----> Verifying repository integrity... done, looks like a Rack app.
       Compiled slug size is 0.1MB
-----> Launching....... done
       App deployed to Heroku

To [email protected]:severe-spring-77.git
 * [new branch]      master -> master

回答by yehyatt

For me it was an unused import in java app , removed the unused import and everything built fine.

对我来说,这是 java app 中未使用的导入,删除了未使用的导入并且一切正常。