场景回忆:
本地修改需要退回到之前的版本,打算强制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就好。
如图:
![1225554-20190826165507190-723194202.png](https://img2018.cnblogs.com/blog/1225554/201908/1225554-20190826165507190-723194202.png)
参考来源:
https://stackoverflow.com/questions/32246503/fix-gitlab-error-you-are-not-allowed-to-push-code-to-protected-branches-on-thi