简体   繁体   中英

I can't do “git push heroku master”

I get error below when I hit git push heroku master .

remote:        Tasks: TOP => assets:precompile
remote:        (See full trace by running task with --trace)
remote:  !
remote:  !     Precompiling assets failed.
remote:  !
remote: 
remote:  !     Push rejected, failed to compile Ruby app
remote: 
remote: Verifying deploy....
remote: 
remote: !   Push rejected to xxx
remote: 
To https://git.heroku.com/xxx.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/xxx.git'

My gem file is below.

source 'https://rubygems.org'

ruby '2.3.0'
gem 'rails_12factor', group: :production
gem 'bootstrap-sass'
gem 'rails', '4.2.5.1'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc

group :production, :staging do
  gem 'unicorn'
end

group :development, :test do
 gem 'capistrano'
 gem 'capistrano-bundler'
 gem 'capistrano-rails'
 gem 'capistrano-rbenv'
end

group :production do
    gem 'pg'
    gem 'rails_12factor'
end


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

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

group :development do

  gem 'web-console', '~> 2.0'

  gem 'spring'
end

I don't know why I got rejected to push my rails app to heroku. I think my Gemfile is alright though. if someone knows solutions for this. I would really appreciate.

The error indicates that there are changes which are newer than commits you have in local.

To solve this:

  1. Pull merge heroku to your local first, then try push to heroku again
  2. Push force to heroku if you are sure that your local is the newest one!

I'll add onto Heiu Pham's answer and say that in Heroku, you may have problems with pushing to the master branch (if you are behind in history for example). What you can do is to start a new branch using

git checkout -b tempbranch and then push using

git push heroku tempbranch

If you are absolutely sure there are no newer refs, you can try

git push heroku -f

If this still doesn't work, check $ heroku logs for a hint to what the problem may be.

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