【问题标题】:Cannot push git repo to Heroku无法将 git repo 推送到 Heroku
【发布时间】:2021-02-03 06:11:35
【问题描述】:

我尝试将我的 git repo 推送到 Heroku,但出现错误:


remote: -----> Installing node-v12.16.2-linux-x64
remote: -----> Detecting rake tasks
remote: 
remote:  !
remote:  !     Could not detect rake tasks
remote:  !     ensure you can run `$ bundle exec rake -P` against your app
remote:  !     and using the production group of your Gemfile.
remote:  !     /tmp/build_641166cf/bin/rake:8:in `require': cannot load such file -- rake (LoadError)
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote:  !
remote:  ! ## Warning - The same version of this code has already been built: 93a5bb6ab6e77c479f857031010316f9f372e20f
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version 93a5bb6ab6e77c479f857031010316f9f372e20f
remote:  ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote:  !
remote:  ! If you are developing on a branch and deploying via git you must run:
remote:  !
remote:  !     git push heroku <branchname>:main
remote:  !
remote:  ! This article goes into details on the behavior:
remote:  !   https://devcenter.heroku.com/articles/duplicate-build-version
remote: 
remote: Verifying deploy...
remote: 
remote: !   Push rejected to whispering-fortress-58873.
remote: 
To https://git.heroku.com/whispering-fortress-58873.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: не удалось отправить некоторые ссылки в «https://git.heroku.com/whispering-fortress-58873.git»

如何解决?这两天我一直在尝试解决这个问题。

  • Ruby 版本:2.7.2
  • Rails 版本:5.2.4.4
  • Gem 版本:3.1.4
  • 捆绑器版本:2.2.7

【问题讨论】:

  • 你见过this吗?也许捆绑器版本不受支持?

标签: ruby-on-rails ruby git rubygems


【解决方案1】:

检查错误日志,您似乎需要将您的分支推送到main

尝试以下操作(或将master 替换为您当前的分支)

git push heroku master:main

【讨论】:

  • 你在哪个分支?
  • 哦,还有一个错误,您可以试试bundle exec rake -P 看看是否有任何错误
  • 我在 master 分支上
  • @DeepakMahakate 我也试过了,但是都成功了
猜你喜欢
  • 1970-01-01
  • 2012-11-11
  • 1970-01-01
  • 2013-03-10
  • 1970-01-01
  • 2015-06-25
  • 2011-08-24
  • 1970-01-01
  • 2018-03-23
相关资源
最近更新 更多