问题描述
使用 git push -f origin master 强制提交时出现
remote: GitLab: You are not allowed to force push code to a protected branch on this project
解决
如果用的是gitlab版本库,这说明gitlab对仓库启用了保护,需要在仓库中设置一下:
“Settings” -> “Repository” -> scroll down to “Protected branches”.
中文版gitlab:选择你的版本库——版本库——分支机构——项目设置——保护分支——接触保护