2

So I'm trying to do my first deploy to Heroku from the command line, and when I run "git push heroku master" I get the following error:

! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/fierce-crag-    
8770.git

There are similar errors discussed elsewhere, and one of the proposed solutions is to first do a git pull and then try to push.

If I run

"git pull heroku master" 

I get the following error:

fatal: Couldn't find remote ref master
Unexpected end of command stream

Another solution was to run this code line by line:

$ rake assets:precompile
$ git add .
$ git commit -m "Add precompiled assets for Heroku"
$ git push heroku master

I got as far as "rake assets:precompile", but then got a "rake aborted" error message.

Any suggestions?

Trent Fowler
  • 103
  • 5
  • What does `git remote -v` show you? – Makoto Dec 14 '15 at 01:06
  • heroku https://git.heroku.com/fierce-crag-8770.git (fetch) heroku https://git.heroku.com/fierce-crag-8770.git (push) origin git@github.com:fowlertm/simplecasts_saas.git (fetch) origin git@github.com:fowlertm/simplecasts_saas.git (push) – Trent Fowler Dec 14 '15 at 01:19
  • So the remotes are pointing to the right location. What does `git fetch heroku` produce? – Makoto Dec 14 '15 at 01:20
  • Running that didn't do anything. – Trent Fowler Dec 14 '15 at 01:21
  • 1
    Okay. Try `git fetch` (which should default to your `origin` remote), followed by `git status`. Does it tell you if you're behind, ahead, or if your branches have diverged? – Makoto Dec 14 '15 at 01:24
  • Told me that I had changes to the README file I needed to commit. I committed them and tried the "git push heroku master" again, still got the same error. – Trent Fowler Dec 14 '15 at 01:26
  • You left out the critical lines of the error message, which should come before `! [remote rejected] master -> master (pre-receive hook declined)`. – Drenmi Dec 14 '15 at 07:08
  • Okay, here are a some more lines: remote: Tasks: TOP => environment 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 fierce-crag-8770. remote: To https://git.heroku.com/fierce-crag-8770.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/fierce-crag-8770.git' – Trent Fowler Dec 14 '15 at 13:10

1 Answers1

0

As commented, the key line is the one before [remote rejected] master -> master (pre-receive hook declined).

This is not about divergent history, but about a hook which prevents the push to complete because of that line.
And it is:

 [remote] ! Precompiling assets failed

But this is only the conclusion of a more complete stack trace, as seen here: only that stack trace would explain the error.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250