! [remote rejected] master -> master (pre-receive hook declined) is the error we receive when either the branch is marked protected or you don’t have permission to push.

According to GitHub Docs –

pre-receive hooks are the scripts that run on the GitHub Enterprise server that you can use to implement quality checks.

Generally, you will get this error in GitLab because it marks the master branch as protected by default.

Since a number of collaborators work on a single branch, it is necessary for version management systems to keep the projects free from anomalies. GitLab has a safety layer for it.

To remove the protection, follow these steps –

  • Go to project Settings.
  • Click on Repository tab.
  • Open Protected Branches.
  • Find your master branch and click on Unprotect.

Overall, check for these issues –

  1. Is your login credentials (SSH Keys) are correct and connected to your git project?
  2. Do you have permission to push your commit? Check if you are developer or maintainer.
  3. Is the configuration correct?
  4. Check if project is unprotected.
  5. You need to pull the changes first before pushing your commit.

Β Β Β Β Tweet this to help others

Tagged in:

,

Comments

About the Author

akamit

I am Akash Mittal, an overall computer scientist. If you want to guest post, need help in your projects, want to advertise, Feel free to contact me at [email protected]

View All Articles