you are not allowed to push code to protected branches on this project(转)
、、
图 1-1
报错:failed to push some refs to 'http://*******.git'。
一痛瞎踅摸之后,远程控制电脑,在H电脑上,重新建立了一个test项目,之后走正常流程:
echo "# 123" >> README.md git init git add README.md git commit -m "first commit" git remote add origin git@github.com:¥%…&&*@/123.git git push -u origin master
push成功没有问题,说明GitLab库级别配置,以及本地GitBash客户端没有问题。于是重新按照这个流程,本地新建文件夹,重新操作。
操作结果同上图1-1所示,失败了。
分析:
1.git clone下来没有问题,commit本地仓库没有问题,就是推不上去,初步怀疑这个项目的配置有问题(读写权限不一致)。
2.委托H同学询问其他同事能不能clone下他们的项目,然后提交上去,等待验证结果中。。。。。。
验证:
查看错误信息时候,发现酱紫的一句提示:“You are not allowed to push code to protected branches on this project.” ,发现了吗?这个项目的branch类型是“protected branches”!!!
紧接着,开始逛StackOverFlow,please pay attention:寻找问题的时候,最好的站点是StackOverflow!!!,效率最高的也是StackOverflow。Besides, attach the link:https://stackoverflow.com/questions/32246503/how-to-fix-you-are-not-allowed-to-push-code-to-protected-branches-on-this-proje 。
睁大眼睛:
there's no problem - everything works as expected.
In GitLab some branches can be protected. By default only 'master' user can commit to protected branches. master branch is protected by default - it forces developers to issue merge requests to be validated by project master before integrating them into main code.
You can turn on and off protection on selected branches in Project Settings (where exactly depends on GitLab version - see instructions below).
On the same settings page you can also allow developers to push into the protected branches. With this setting on, protection will be limited to rejecting operations requiring git push --force (rebase etc.)
结合本文第一行的提示,公司新装的gitlab。GitLab一些分支默认被保护,仅仅拥有master级别的用户才能提交到保护分支,而且master分支默认是保护分支,其他用户需要通过合并issue请求来提交上去,靠!找到了。
Since GitLab 9.0
Project: "Settings" -> "Repository" -> scroll down to "Protected branches".
Now you can select who is allowed to merge or push into selected branches (for example: you can turn off pushes to master at all, forcing all changes to branch to be made via Merge Requests). Or you can click "Unprotect" to completely remove protection from branch.
如图:
(1)
(2)
总结:
1.定位问题是权限问题之后,就该把问题上报了,而且解决方案一并交给组长,是不是有很爽的感觉。
2.新装的gitLab,master分支默认protectd,这一点很坑啊!!!
---------------------
作者:暂7师师长常乃超
来源:CSDN
原文:https://blog.csdn.net/zzh920625/article/details/78087669
版权声明:本文为博主原创文章,转载请附上博文链接!
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· PostgreSQL 和 SQL Server 在统计信息维护中的关键差异
· C++代码改造为UTF-8编码问题的总结
· 【.NET】调用本地 Deepseek 模型
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· DeepSeek “源神”启动!「GitHub 热点速览」
· 我与微信审核的“相爱相杀”看个人小程序副业
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库
2018-05-15 linux下切换python2和python3(转)