How to solve Git "pre-receive hook declined" error

If you're experiencing a Git "pre-receive hook declined" error, there are a few options how to fix it. 

The most common reason is that in your repository (for example GitLab) the master branch is now “protected” and the main branch have a name “main”.

Possible solutions:

  • In the project settings (Settings > Repository), go to the section of protected branches "Protected branches", find the branch "master" and click on "Unprotect".
  • As an alternative solution, you can set your user permission to make changes in this branch.


No comments yet, you can leave yours: