I have run gitlabhq rails server on virtual machine, following 1-6 steps from this tutorial https://github.com/gitlabhq/gitlab-recipes/blob/master/install/centos/README.md a
GitLab by default marks master
branch as protected
(See part Protecting your code
in https://about.gitlab.com/2014/11/26/keeping-your-code-protected/ why). If so in your case, then this can help:
Open your project > Settings > Repository and go to "Protected branches", find "master" branch into the list and click "Unprotect" and try again.
via https://gitlab.com/gitlab-com/support-forum/issues/40
For version 8.11 and above how-to here: https://docs.gitlab.com/ee/user/project/protected_branches.html#restricting-push-and-merge-access-to-certain-users
I solved this issue by changing remote 'origin' url
from http
to git
protocol in .git/config
Might not be the case, but this was the solution to my "pre-receive hook declined" error:
There are some repositories that only allow modifications through Pull Request. This means that you have to
Despite the question is specific to gitlab, but similar errors can happen on github, depending how it is set up (usually Github Enterprise).
You need to familiarize yourself with the following concepts:
Webhooks are more commonly understood than other two items.
The Pre-receive hooks
are scripts that run on the GitHub Enterprise server to enforce policy. When a push occurs, each script runs in an isolated environment to determine whether the push is accepted or rejected.
Organization webhooks:
Webhook events are also sent from your repository to your "organization webhooks". more info.
These are set up in your github enterprise. They are specific to the version of the github enterprise. You may have no visibility because of your access limitations (developer, maintainer, admin, etc).
In my case, my team lead to created a repo(repo was empty) and assign me as developer so when I pushed to the code directly to master the error I was facing ! [remote rejected] master -> master (pre-receive hook declined)
So how it was fixed that he assigned to me as maintainer so I was able to push the code directly to the master.
Seems the problem is with some services, like sidekiq. Running sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
outputs all the problems with config.