【问题标题】:Heroku rejecting push in mature application (pre-receive hook declined)Heroku 在成熟应用中拒绝推送(pre-receive hook 被拒绝)
【发布时间】:2023-03-11 10:59:01
【问题描述】:

我来了

   FAILED: http://devcenter.heroku.com/articles/bundler

! Heroku 推送被拒绝,无法通过 Bundler 安装 gem 到 git@heroku.com:... ! [remote denied] master -> master (pre-receive hook denied) 错误:未能将一些引用推送到………….. (完整列表见底部)

这是一个目前正在使用 heroku 的应用程序,但 heroku 不允许 git push heroku master 更新代码。

但是,如果我将代码克隆到一个新文件夹并执行 heroku create 以使用种子数据创建一个新应用程序,则新应用程序可以正常工作。但是,我不想使用新应用,因为我有关于我想要保留的功能应用的数据。

现有应用或宝石上似乎有一些东西拒绝更新。我认为数据不会阻止 gem 的安装,所以我不知道该怎么做。

建议?

“Heroku 推送被拒绝,无法通过 Bundler 安装 gems”是否意味着问题出在更新 gem 中,或者这是一个红鲱鱼?

谢谢。

$ git push heroku master 计数对象:536,完成。 Delta 压缩最多使用 2 个线程。 压缩对象:100% (125/125),完成。 写入对象:100% (391/391),1.08 MiB,完成。 总计 391(增量 262),重复使用 373(增量 251)

-----> Heroku receiving push
-----> Removing .DS_Store files
-----> Rails app detected
-----> Detected Rails is not set to serve static_assets
       Installing rails3_serve_static_assets... done
-----> Configure Rails 3 to disable x-sendfile
       Installing rails3_disable_x_sendfile... done
-----> Configure Rails to log to stdout
       Installing rails_log_stdout... done
-----> Gemfile detected, running Bundler version 1.0.7
       Unresolved dependencies detected; Installing...
       Using --without development:test
       Windows Gemfile.lock detected, ignoring it.
       You have modified your Gemfile in development but did not check
       the resulting snapshot (Gemfile.lock) into version control
   You have added to the Gemfile:
   * source: rubygems repository http://rubygems.org/
   * rails (= 3.0.5)
   * haml
   * haml-rails
   * sqlite3-ruby
   * devise (= 1.1.5)
   * omniauth
   * declarative_authorization
   * will_paginate (= 3.0.pre2)
   * nifty-generators
   * acts-as-taggable-on
   * acts_as_commentable
   * aws-s3
   * jquery-rails
   * rspec-rails
   * annotate
   * faker (= 0.3.1)
   * hpricot (= 0.8.3)
   * ruby_parser
   * paperclip (~> 2.3)
   * formtastic (~> 1.2.3)
   * hirb
   * kaminari
   * rspec (= 2.5.0)
   * webrat
   * factory_girl_rails (= 1.0)
   * cucumber
   * mocha
   FAILED: http://devcenter.heroku.com/articles/bundler

! Heroku 推送被拒绝,无法通过 Bundler 安装 gems

致 git@heroku.com:... ! [remote denied] master -> master (pre-receive hook denied) 错误:未能将一些引用推送到…………..

【问题讨论】:

标签: ruby-on-rails ruby heroku gem


【解决方案1】:
You have modified your Gemfile in development but did not check
the resulting snapshot (Gemfile.lock) into version control

这意味着您已将 gem 添加到 gemfile 但尚未更新。 Gemfile.lock 与此文件不同步。

您需要更新您的捆绑包。

在应用目录的控制台中运行此命令:bundle

那就git push heroku

你应该很高兴。

**核对应用程序并重新开始。

gem install taps #install taps
heroku db:pull   #pull your data to your local machine

rm -rf .git #remove your git repo 
git init    #create a new repo
git add .   #add all the files
git commit -m 'master' #commit as master

heroku create #create a new heroku app
heroku rename myapp #rename the app
git push heroku master #push to heroku

heroku db:push #push your data to heroku

这应该会启动一个新应用程序。

【讨论】:

  • 谢谢,但它似乎比这更复杂。也许有些东西已经被破坏了。在某些时候,我们中的一个人将 Gemfile.lock 放在了 .gitignore 文件中,这可能就是麻烦的开始。我刚刚做的是从 .gitignore 中删除该行,删除 Gemfile.lock,运行 bundle install 重新生成它,添加 Gemfile.lock 并提交,然后再次推送到 heroku。我收到了同样的信息。所以有些事情搞砸了。有什么方法可以告诉 Heroku 和 git 从头开始​​使用 gems?
  • 所以你确实运行了bundle,它创建的包没有错误?
  • 是的,无论我运行 bundle 还是 bundle install,我都没有收到任何错误消息,并且类似 Your bundle is complete!使用 bundle show [gemname] 查看捆绑 gem 的安装位置。
  • 好的。所以接下来我要做的是删除 gem.lock 文件。那就是问题损坏了。
  • 顺便说一句,确保 Gemfile.lock 确实被删除了。
【解决方案2】:

我刚刚遇到了同样的问题,下面为我解决了这个问题:

我有一个按需求(测试、开发等)分组的 gem 组合,以及一些两者都使用的 gem,例如

group :development do
  gem "hpricot"
  gem "ruby_parser"
  gem "haml-rails", ">= 0.3.4"
end

和

gem "rspec-rails", ">= 2.9.0.rc2", :group => [:development, :test]

我删除了单行的,只是将它们复制到相关的块中(我知道不是 DRY,但到底是什么)。

做了一个快速的 Bundle,嘿,我可以再次推送到 Heroku...

【讨论】:

    【解决方案3】:

    根据我的阅读,这是一个 Windows 问题。

    Why won't Heroku accept my Gemfile.lock in Windows?

    我花了几个小时试图弄清楚这一点,但没有骰子。是时候转移到虚拟机并在那里尝试了。无赖。

    【讨论】:

      【解决方案4】:

      我遇到了同样的错误,在命令行中运行以下代码解决了它:

      $ heroku config:set BUNDLE_WITHOUT="development:test"


      我认为上述 gemfile.lock 问题是红鲱鱼。

      【讨论】:

        【解决方案5】:

        或者,Heroku 可能遇到 API 问题并且已关闭。检查https://status.heroku.com/

        今天我遇到了一个成熟的应用程序。

        【讨论】:

          猜你喜欢
          • 2017-01-09
          • 2021-09-22
          • 1970-01-01
          • 1970-01-01
          • 2014-04-20
          • 1970-01-01
          • 2016-08-14
          • 2014-08-19
          相关资源
          最近更新 更多