Fix GitLab error: “you are not allowed to push code to protected branches on this project”?

前端 未结 9 1987
野趣味
野趣味 2020-11-29 15:04

I have a problem when I push my codes to git while I have developer access in my project, but everything is okay when I have master access. Where is the problem come from? A

相关标签:
9条回答
  • 2020-11-29 15:44

    I experienced the same problem on my repository. I'm the master of the repository, but I had such an error.

    I've unprotected my project and then re-protected again, and the error is gone.

    We had upgraded the gitlab version between my previous push and the problematic one. I suppose that this upgrade has created the bug.

    0 讨论(0)
  • 2020-11-29 15:44

    The above solutions explain clearly what the problem is; when you don't have control over the repo, the best way to submit your code is to create a Fork of the original repo and submit your code to this new repo so later you can push it to the original one.

    0 讨论(0)
  • 2020-11-29 15:45

    I have encountered this error on "an empty branch" on my local gitlab server. Some people mentioned that "you can not push for the first time on an empty branch". I tried to create a simple README file on the gitlab via my browser. Then everything fixed amazingly and the problem sorted out!! I mention that I was the master and the branch was not protected.

    0 讨论(0)
  • 2020-11-29 15:49

    Try making changes as per link

    https://docs.gitlab.com/ee/user/project/protected_branches.html

    make the project unprotected for maintainer or developer for you to commit

    0 讨论(0)
  • 2020-11-29 15:49

    This is considered as features in Gitlab.

    Maintainer / Owner access is never able to force push again for default & protected branch, as stated in this docs

    0 讨论(0)
  • 2020-11-29 15:52

    Simple solution for this problem to have quick chat with person who has owner role in gitlab. He can push one file READ.md or similar to just start with. Later, everything will be working as earlier.

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