1. Force pushing on GitLab reports the error: remote GitLab You are not allowed to force push code to a protected branch on this project. See Figure 1.

git.exe push --force-with-lease --progress "origin" master:master
Total 0 (delta 0), reused 0 (delta 0)
remote: GitLab: You are not allowed to force push code to a protected branch on this project.
To https://gitlab.chinamcloud.com/php/yii2-app-advanced.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://gitlab.chinamcloud.com/php/yii2-app-advanced.git'
git did not exit cleanly (exit code 1) (3109 ms @ 2020/06/29 16:09:02)
2. Check GitLab – Members – Existing members and groups. Master should theoretically have the permissions. See Figure 2.

3. Repository Settings – Protected Branches – Allowed to push. It is set to: Masters. See Figure 3.

4. Repository Settings – Protected Branches – Allowed to push. Change it to: Developers + Masters. See Figure 4.

5. Push again, and it reports the error: error: failed to push some refs to. See Figure 5.

6. Check the commit history and reset to the latest version before the merge into the master branch. See Figure 6.

7. Repository Settings – Protected Branches. Delete the master branch and click the Unprotect button. See Figure 7.

8. Push again, and the push succeeds. Restore the operations performed in step 7 and step 4. See Figure 8.

git.exe push --force-with-lease --progress "origin" master:master
Total 0 (delta 0), reused 0 (delta 0)
To https://gitlab.chinamcloud.com/php/yii2-app-advanced.git
+ a80db96...8fb427a master -> master (forced update)
Success (2921 ms @ 2020/06/29 16:42:52)
