git, Heroku: pre-receive hook declined

后端 未结 15 2828
时光取名叫无心
时光取名叫无心 2020-12-09 02:33

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 rec

相关标签:
15条回答
  • 2020-12-09 02:42

    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 logs --tail. That gave me another hint to turn off collectstatic, it event tells you what to type to turn it off.

    0 讨论(0)
  • 2020-12-09 02:44

    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
    
    0 讨论(0)
  • 2020-12-09 02:44

    Came across this same error when deploying a node app, but resolved with these two steps and thought I'd share in case anyone else runs into the same issues.

    1. Make sure you aren't committing node_modules since heroku installs dependencies from package.json on push. Try adding node_modules/ to your .gitignore to ensure you don't accidentally commit it
    2. Heroku uses Node v12 which node-sass 4.10.0 will fail to build with. Try increasing node-sass version by adding the following. This allowed it to build successfully for me:
      "devDependencies": {
        "node-sass": "^4.12.0"
      }
    
    0 讨论(0)
  • 2020-12-09 02:46

    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!

    0 讨论(0)
  • In my case I had an npm script called "build" that had the as value npm run build --prefix client.

    Heroku automatically executes the npm run build command and it couldn't build my React app. Probably because Heroku didn't install react-scripts module.

    So I renamed the command to build-client and now I can push the changes to Heroku.

    0 讨论(0)
  • 2020-12-09 02:53

    Try Updating Node/php or any engines to latest version and then deploy again it will work for sure.

    0 讨论(0)
提交回复
热议问题