remote rejected master -> master (pre-receive hook declined)

Git

Git Problem Overview


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?

Git Solutions


Solution 1 - Git

Make sure that your Rails app is in the root of the repo, the Gemfile is present and properly named. It is basically not able to detect your code base as one of the supported project types and hence failing it. Also, even if you do have a proper project, make sure it is part of the repository and you have committed it fine (git status will help you here and a ls should help you verify the project structure).

Solution 2 - Git

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

Solution 3 - Git

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.

Solution 4 - Git

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.

Solution 5 - Git

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.

Solution 6 - Git

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

Solution 7 - Git

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.

Solution 8 - Git

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

Solution 9 - Git

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.

Solution 10 - Git

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

Solution 11 - Git

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.

Solution 12 - Git

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.

Solution 13 - Git

Try to change your role to the role of the maintainer of the project before pushing...

This solved my issue for me.

Solution 14 - Git

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

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

Solution 15 - Git

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

Solution 16 - Git

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.

Solution 17 - Git

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

Solution 18 - Git

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 

Solution 19 - Git

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

Solution 20 - Git

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

Solution 21 - Git

simple answer

$ heroku config:set DISABLE_COLLECTSTATIC=1

after

$ git push heroku master

Solution 22 - Git

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"}

Solution 23 - Git

Checking and updating the requirements.txt actually worked for me. I had a few wrong package names. Remember to commit before pushing!

Solution 24 - Git

In my case, the issue was Node Modules which was also being pushed (not included in .gitignore). I referred this and my issues was resolved.

echo 'node_modules' >> .gitignore
git rm -r --cached node_modules
git commit -am 'ignore node_modules'

Solution 25 - Git

I had the same issue. I had two different lock files in my folder, package-lock.json, and yarn.lock, then I deleted the yarn.lock file and it worked smoothly.

Solution 26 - Git

enter image description here

In my own case, I tried deleting the node_module, package-lock.json and ran npm install but none of this worked. found out Heroku was using a lower version of node. Addin this to my package.json solved it.

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

Solution 27 - Git

I had the same issue. check that you make git init on the backend folder!!

Solution 28 - Git

try add this to the pom file

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <source>1.8</source>
        <target>1.8</target>
    </configuration>
</plugin>

Solution 29 - Git

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBrian McDonoughView Question on Stackoverflow
Solution 1 - GitmanojldsView Answer on Stackoverflow
Solution 2 - GitBoraView Answer on Stackoverflow
Solution 3 - GitChelseaView Answer on Stackoverflow
Solution 4 - GitPanicBusView Answer on Stackoverflow
Solution 5 - GitfebruaryInkView Answer on Stackoverflow
Solution 6 - GitAndré VillarView Answer on Stackoverflow
Solution 7 - GitCaio EuzébioView Answer on Stackoverflow
Solution 8 - GitSavad KPView Answer on Stackoverflow
Solution 9 - GitArtaView Answer on Stackoverflow
Solution 10 - GitAaron MorenoView Answer on Stackoverflow
Solution 11 - GitFranklin OkolieView Answer on Stackoverflow
Solution 12 - Gitvinayak hurkadliView Answer on Stackoverflow
Solution 13 - GitAlagie F. NgetView Answer on Stackoverflow
Solution 14 - Gituser2296554View Answer on Stackoverflow
Solution 15 - GitlearningBunnyView Answer on Stackoverflow
Solution 16 - GitRobertJosephView Answer on Stackoverflow
Solution 17 - GitV4vedukeView Answer on Stackoverflow
Solution 18 - GitRameshDView Answer on Stackoverflow
Solution 19 - GitJordy TshibssView Answer on Stackoverflow
Solution 20 - GitdavidView Answer on Stackoverflow
Solution 21 - GitJ ZeroView Answer on Stackoverflow
Solution 22 - GitArjjunView Answer on Stackoverflow
Solution 23 - GitnsdeView Answer on Stackoverflow
Solution 24 - Gitshubham shreyashView Answer on Stackoverflow
Solution 25 - GitMahadi Hassan RiyadhView Answer on Stackoverflow
Solution 26 - GitPope FrancisView Answer on Stackoverflow
Solution 27 - Gitidan noyshulView Answer on Stackoverflow
Solution 28 - GitOsama RafeaView Answer on Stackoverflow
Solution 29 - GitkapilView Answer on Stackoverflow