Folow the steps:
- Try push
git push
-failed to push some refs to
git push -f
-remote rejected
- The branch is in a protected state and cannot be forced to operate
Gitlab -> Repository -> Branches
- Temporarily remove branch protection
Gitlab -> Settings -> Repository -> Protected Branches -> Unprotect
- Try pushing again
git push -f
- Add back protection
Gitlab -> Settings -> Repository -> Protected Branches -> Protect a branch
Branch -> Allowed to merge + Maintainers - Allowed to push + Maintainers -> Allowed to force push + No -> Protect