Can not create protected branch in this project in Gitlab

Viewed 1088

I have a project in gitlab. My colleague has a maintaner status there. I have a developer status. He asked me to push a files there with a new branch. Then to merge request, in order he could check it and accept. But when I push, I get the following error:

remote: GitLab: You are not allowed to create protected branches on this project.

To ".../..../myProject"

! [remote rejected] myBranch -> myBranch (pre-receive hook declined)

error: failed to push some refs to '.../..../myProject'



Here's what I did:
git clone .... // cloned the project as there were already files

// then added my files to the cloned project, created a new branch and did add

    git add.
    
    git commit -m "..."
    
    git push origin myBranch
2 Answers

If i'm not mistaken the problem is that by default GitLab only allows Maintainers to create new protected branches.

So maybe this has something to do with permissions in the repo, you should check in GitLab if you are using wildcards in the protected branches protection.

Your project is set up in such a way so you are not allowed to work directly with git, but rather through forks. This is how GitHub is set up as well.

Fork the git into your space by clicking the fork button:

enter image description here

After this, you will be able to checkout your fork, and will be able to create your own branches, etc. When you need to create a merge request, you need to click New merge request in the original git:

enter image description here

And then select your git and branch, and original git and it's target branch.

Related