[git] remote rejected master -> master (pre-receive hook declined)

I'm working in rails 3.2 and I receive an error when I try to push to heroku:

 git push heroku master
Counting objects: 496, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (435/435), done.
Writing objects: 100% (496/496), 5.17 MiB | 249 KiB/s, done.
Total 496 (delta 125), reused 216 (delta 8)

-----> Heroku receiving push
-----> Removing .DS_Store files
 !     Heroku push rejected, no Cedar-supported app detected

To [email protected]:lumeo.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:lumeo.git'

I have tried the few methods recommended on this forum, including emptying and reinstalling the Gems and deleting and adding the remote, to no avail.

any suggestions?

This question is related to git

The answer is


In my case I had forgotten to use postgres in my production environment. I moved the sqlite3 gem into my development and test groups in my Gemfile. Everything worked after that.


I had the same issue.

Look at your git ignore and check if .env is not ignored.

It was my problem and resolved to my case.


Mine finally worked somewhere along this road:

  1. Updating Git
  2. back to \my_first_rail_app\, type or run:
    • a. bundle install
    • b. bundle install --gemfile
    • c. bundle update
    • d. git add .
    • e. git commit -m "updates for heroku deployment"
    • f. git pust heroku master (still wont work with my case)
    • g. heroku buildpacks:set https://github.com/bundler/heroku-buildpack-bundler2

Check the following

  1. Make sure you add all the files and directories needed to be tracked are added using git status [You have done this]

    $ git status

  2. If not added then add them using **git add . ** [You have done this]

    $ git add .

  3. Bundle all gems and you will have Gemfile.lock

    $ bundle install
    $ git add Gemfile.lock
    $ git commit -am "Added Gemfile.lock"

  4. Push it to heroku

$ git push heroku master

Your push should work


In Heroku, you may have problems with pushing to the master branch. What you can do is to start a new branch using

git checkout -b tempbranch

and then push using

git push heroku tempbranch


simple answer

$ heroku config:set DISABLE_COLLECTSTATIC=1

after

$ git push heroku master


I also faced the same issue The solution for this is

Delete the package-lock.json file on both the client and server

Make sure that you are using at least the LTS version of Node locally

Make sure your local Node version matches what is shown in the package.json file's engines property.

Run the git add . , git commit -m "fixing versions" and git push heroku master commands to force a rebuild.


You might need to update the heroku version heroku update. I recently had that issue then I updated from version 7.42.2 to 7.47.5

my engine version is "engines": {"node":"14.8.0","npm":"6.14.7"}


I was getting the same error, and running the following code in the command line solved it:

$ heroku config:set BUNDLE_WITHOUT="development:test"

For completeness, the issue may be heroku itself. In rare cases like these https://status.heroku.com would show something along the lines of:

Update

The Heroku Dashboard and Elements have been restored. We are still working to restore the other affected services.

The services still affected are:

  • Builds
  • Review apps
  • Pipelines
  • Github deploys
  • Heroku CI
  • Heroku Buttons

I was able to deploy about 40 minutes later after heroku reported:

All affected services have been restored and are now working as expected. We will be monitoring to ensure there are no further issues.


Specify the version of node The version of Node.js that will be used to run your application on Heroku, should also be defined in your package.json file. You should always specify a Node.js version that matches the runtime you’re developing and testing with. To find your version type node --version.

Your package.json file will look something like this:

"engines": { "node": "10.x" },

It should work


I got the same error and looked into activity. Where I found that I had two package lock files which was causing the error.


I have just run the heroku logs command and checked the git status then retried the git push hreoku master and it worked


If you get this error and the terminal is not descriptive enough to help you, Heroku might be able to tell you what is wrong through their website. Try the following:

  1. log in to Heroku and go to your dashboard;
  2. select the problem application from the list; and,
  3. check the build logs under the "Activity" tab.

In my case, I had accidentally ignored my Gemfile.lock.


just in case you have this problem while trying to push a django app to heroku and then you get this error:

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

simply look for this :

Error while running '$ python manage.py collectstatic --noinput'. remote: See traceback above for details. remote: remote: You may need to update the application code to resolve this error. remote: Or, you can disable collectstatic for this application: remote: remote: $ Heroku config:set DISABLE_COLLECTSTATIC=1

Copy this : $ Heroku config:set DISABLE_COLLECTSTATIC=1

and paste it in the terminal. Press Enter and after that run: $ git push Heroku master

This should solve your problem if Django app is what you are trying to push.


My initial error in overview building log was... /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/bin/support/ruby_compile:15:in' ! Push rejected, failed to compile Ruby app. ! Push failed`

Through 2 days of trying...this worked heroku buildpacks:set https://github.com/heroku/heroku-buildpack-nodejs

In part it was my proxy and the buildpack


I got the same error when I ran git status :

$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)
nothing to commit, working directory clean

To fix it I can run:

$ git push and run 
$ git push heroku master

You might also want to check for Heroku telling you there's a typo in your CSS file.

Read through the long boring messages in the terminal closely after you push. There may be something like this: Invalid CSS after. It means Heroku has found a typo and you need to fix it in the CSS file.

You can do a find for rake aborted! and directly after that it should say why the push failed.


If you run $ heroku logs you may get a "hint" to what the problem is. For me, Heroku could not detect what type of app I was creating. It required me to set the buildpack. Since I was creating a Node.js app, I just had to run $ heroku buildpacks:set https://github.com/heroku/heroku-buildpack-nodejs. You can read more about it here: https://devcenter.heroku.com/articles/buildpacks. No pushing issues after that.

I know this is an old question, but still posting this here incase someone else gets stuck.


I was facing the same problem.

[remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to ""

Cause of Error :
I was in develop branch and trying to push to remote master branch

Solution:
Checkout to develop branch(another branch) and execute :

git push heroku develop 

The package setuptools/distribute is listed in requirements.txt. Please remove the same.