qaz*_*wsx 6 git git-push gitlab
git push --force gitlab master
Enumerating objects: 50, done.
Counting objects: 100% (50/50), done.
Delta compression using up to 8 threads
Compressing objects: 100% (29/29), done.
Writing objects: 100% (40/40), 12.22 KiB | 4.07 MiB/s, done.
Total 40 (delta 26), reused 18 (delta 11)
remote: GitLab: You are not allowed to force push code to a protected branch on this project.
To gitlab.com:xxx/yyyy.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@gitlab.com:xxx/yyyy.git'
Run Code Online (Sandbox Code Playgroud)
我应该怎么做才能将提交推送到Gitlab?我使用了多个遥控器,其他遥控器都可以,我可以完成
git push --force some_other_remote master
Run Code Online (Sandbox Code Playgroud)
按照上述步骤操作,您将看到与下面类似的框。

图片来源:https : //docs.gitlab.com/ee/user/project/protected_branches.html
在那里,您可以单击Unprotect要强制推送到的分支的橙色按钮,即master。
如果您不想浏览导航栏,也可以填写以下URL模板:
https://gitlab.com/<USERNAME>/<PROJECTNAME>/settings/repository#js-protected-branches-settings
Run Code Online (Sandbox Code Playgroud)
并更换<USERNAME>及<PROJECTNAME>分别与特定的用户名和项目名称。
更多帮助:
正如 GitLab文档所述:\n默认情况下,受保护的分支会执行四件简单的事情:
\n所以你需要暂时取消对分支的保护。最后,将其恢复到原来的状态。
\n为此:
\n| 归档时间: |
|
| 查看次数: |
3377 次 |
| 最近记录: |