相关疑难解决方法(0)

修复Gilab错误:"您不能将代码推送到此项目的受保护分支"?

当我在我的项目中有开发人员访问权限时将代码推送到git时出现问题,但是当我有主访问权限时一切正常.问题出在哪里?以及如何解决它?

错误信息:

错误:您不能将代码推送到此项目的受保护分支.
...
错误:未能推送一些参考...

branch git-push git-add git-commit gitlab

295
推荐指数
5
解决办法
23万
查看次数

如何强制推送到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)

git git-push gitlab

6
推荐指数
3
解决办法
3377
查看次数

标签 统计

git-push ×2

gitlab ×2

branch ×1

git ×1

git-add ×1

git-commit ×1