EN
Fix for Gitlab - failed to push some refs
4 points
After I make git push to gitlab repository I got an error:
xxxxxxxxxx
1
! [remote rejected] main -> main (pre-receive hook declined)
2
error: failed to push some refs to 'gitlab.com:my_username/my_project_name.git'
There is a problem with Protected branches.
Probably you make git push to master or main branch which are by default protected on gitlab.
There are 2 solutions:
- make feature_branch and make merge request to master or main branch
- unprotect master or main branch (we will be able to push to master or main branch)
Steps to unprotect a branch in gitlab:
- Go to your project and select Settings -> Repository.
- Expand Protected branches.
- Click 'Unprotect' button
Here is a screenshot how to do that:
