Git push error pre-receive hook declined

前端 未结 14 1093
眼角桃花
眼角桃花 2020-11-28 03:06

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

相关标签:
14条回答
  • 2020-11-28 03:40

    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

    0 讨论(0)
  • 2020-11-28 03:40

    I solved this issue by changing remote 'origin' url from http to git protocol in .git/config

    0 讨论(0)
  • 2020-11-28 03:41

    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

    1. Create a new branch taking as base the branch that you want to push your changes to.
    2. Commit and push your changes to the new branch.
    3. Open a Pull Request to merge your branch with the original one.
    0 讨论(0)
  • 2020-11-28 03:43

    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:

    • pre-receive hooks
    • organization webhooks
    • Webhooks

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

    0 讨论(0)
  • 2020-11-28 03:46

    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.

    0 讨论(0)
  • 2020-11-28 03:52

    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.

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