【错误解决】git报错:you are not allowed to push code to protected branches on this project

场景回忆:
本地修改需要退回到之前的版本,打算强制push本地版本覆盖远程版本,但是在git push --force后出现了以下的错误:
Fix GitLab error: “you are not allowed to push code to protected branches on this project”?

问题原因:
原来gitlab对应的分支进行分支保护设置。

解决方法:
"Settings" -> "Repository" -> scroll down to "Protected branches" 改成unprotected就好。

如图:

参考来源:
https://stackoverflow.com/questions/32246503/fix-gitlab-error-you-are-not-allowed-to-push-code-to-protected-branches-on-thi

原文地址:https://www.cnblogs.com/everfight/p/protected_branches.html