简体   繁体   中英

Cannot push git repo to Heroku

I try to push my git repo to Heroku, but I get error:


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»

How to fix it? I've been trying to fix this for two days now.

  • Ruby version: 2.7.2
  • Rails version: 5.2.4.4
  • Gem version: 3.1.4
  • Bundler version: 2.2.7

Checking error logs it seems that you need to push your branch to main

Try the following (or replace master with your current branch)

git push heroku master:main

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM