git, Heroku: pre-receive hook declined

I am in the process of setting up a git repository and attempting to link it to Heroku. When I run the command

git push heroku master

I receive

  • Putting a project in Eclipse under source control
  • What happen to Git tags pointing to a removed commit
  • How do I get the Git log for a specific branch only?
  • How to ignore source files in bower
  • Is it possible to Git merge / push using Jenkins pipeline
  • How do I log unique authors in git?
  • Counting objects: 7, done.
    Delta compression using up to 2 threads.
    Compressing objects: 100% (5/5), done.
    Writing objects: 100% (7/7), 714 bytes, done.
    Total 7 (delta 1), reused 0 (delta 0)
    
    -----> Heroku receiving push
    
     !     Heroku push rejected due to an unrecognized error.
     !     We've been notified, see http://support.heroku.com if the problem persists.
    
    
    To git@heroku.com:morning-stream-3712.git
     ! [remote rejected] master -> master (pre-receive hook declined)
    error: failed to push some refs to 'git@heroku.com:morning-stream-3712.git'
    

    I’m not quite sure what other information would be helpful and what will just muddy the waters, so I’ll just leave it at this for now. Any help getting my application pushed to Heroku would be greatly appreciated. Thanks.

  • I can't use git to push my source code, It said “Permission denied (publickey).”
  • Heroku + git = ENOENT: spawn git ENOENT
  • How do I checkout a single folder from git
  • Cannot SSH using private key while building Docker image
  • How can I pull every linux kernel commit request?
  • What is the best practice for pushing clean code to the main branch in Mercurial?
  • 6 Solutions collect form web for “git, Heroku: pre-receive hook declined”

    Make sure you are pushing a repo that contains a proper supported app ( Rails, Django etc.) and you are not just pushing some random repo to test it out.

    Newbie in Heroku: Error when push my app to Heroku

    If that is not the case and you are pushing what you think is a valid app, contact Heroku support and they will fix it for you.

    I faced the same problem:

    ! [remote rejected] vX.X.XX -> master (pre-receive hook declined) 
    error: failed to push some refs to 'git@heroku.com:[application-name]'
    

    I realized that my heroku application Stack is ‘cedar-10’ and was deprecated from 04/11/2014 and disabled from 04/11/2015 (Cedar-14 is now Generally Available).

    The solution was to upgrade the heroku application Stack following the guide:

    Upgrading the production app to Cedar-14

    I had the same problem but with a Django app, it turned out that pip wasn’t able to download/install one of the dependencies of the requirements.txt file (it was eyeD3)

    Another issue could be that in a production environment, you can’t use sqlite3, the default database when you make a rails app.

    In order to fix this, just change the database your rails app uses to Postgres. This can easily be accomplished by editing your Gemfile

    From your Gemfile, remove:

    gem sqlite3;
    

    and add the following:

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

    In case someone makes the same dumb mistake I did…

    If you have an error in your css this error can also show up.

    In one of my media queries I put

    @media screen adn (min-width: 1000px) {
    

    Instead of the “and” which gave me this error.

    A good indicator that this may be the case is if you get an error that contains the message

    "Tasks: TOP => assets:precompile ... Precompiling assets failed" 
    

    That was my first clue to look in my css.

    Hope this helps someone!

    A little late to the game, one of my issues was I had an outdated sshkey. Just need to update that in the settings.

    Another thing was I was pushing Python Django CMS, and it was running python manage.py collectstatic during deploy and it was failing. So make sure you check the log heroku log --tail. That gave me another hint to turn off collectstatic, it event tells you what to type to turn it off.

    Git Baby is a git and github fan, let's start git clone.