Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

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?

like image 684
Brian McDonough Avatar asked Mar 03 '12 01:03

Brian McDonough


People also ask

How do you solve remote rejected main -> main pre-receive Hook declined?

If your master branch is protected, you will get the gitlab ! [remote rejected] master -> master (pre-receive hook declined) error. Unprotect your master branch to solve the issue. If you can't push code directly to the master and get errors, you need to be the maintainer of the repo.

What does pre-receive Hook declined mean?

Your commits were rejected by the pre-receive hook of that repo (that's a user-configurable script that is intended to analyze incoming commits and decide if they are good enough to be accepted into the repo). It is also a good idea to ask that person to update the hook, so it would print the reasons for the rejection.

Why would you use a pre-receive hook in your remote repository?

Pre-receive hooks enforce rules for contributions before commits may be pushed to a repository. Pre-receive hooks run tests on code pushed to a repository to ensure contributions meet repository or organization policy. If the commit contents pass the tests, the push will be accepted into the repository.

How do I force git push?

To force a push to only one branch, use a + in front of the refspec to push (e.g git push origin +master to force a push to the master branch).


2 Answers

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).

like image 167
manojlds Avatar answered Oct 19 '22 21:10

manojlds


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

like image 30
Bora Avatar answered Oct 19 '22 20:10

Bora