【发布时间】:2019-06-03 15:58:08
【问题描述】:
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'
我应该怎么做才能将我的提交推送到 Gitlab?我使用了几个遥控器,其他遥控器都可以,我能完成
git push --force some_other_remote master
【问题讨论】:
-
你不能强制推送,因为“你不能强制将代码推送到这个项目的受保护分支”。
push --force是你如何强制推送到 GitLab 或其他任何地方,只要你被允许。