当我在项目中拥有开发人员访问权限时,我将代码推到git时遇到了一个问题,但当我拥有主访问权限时,一切都很好。问题从何而来?如何解决呢?
错误信息:
错误:不允许将代码推送到此项目上受保护的分支。 ... 错误:failed to push some refs to…
当我在项目中拥有开发人员访问权限时,我将代码推到git时遇到了一个问题,但当我拥有主访问权限时,一切都很好。问题从何而来?如何解决呢?
错误信息:
错误:不允许将代码推送到此项目上受保护的分支。 ... 错误:failed to push some refs to…
当前回答
用于GitLab企业版9.3.0
缺省情况下,主分支是受保护的 所以不保护:)
1-选择你的“项目”
2-Select“库”
3-Select“分支”
4选择“项目设置”
5-在“受保护分支”中点击“展开”
6 .之后点击“取消保护”按钮
其他回答
我在本地gitlab服务器的“空分支”上遇到了此错误。有人提到“你不能在空树枝上第一次推”。我尝试通过浏览器在gitlab上创建一个简单的README文件。然后一切都神奇地解决了,问题得到了解决!!我提到我是主人,分支不受保护。
当您发出远程错误消息时:不允许将代码推入此项目。和请求的URL返回错误:403
尝试设置git用户,
要在按下代码前提示用户名,请使用
$ git config --local credential.helper ""
输入用户名和密码后,登录成功
$ git push
对我来说,在创建个人访问令牌时,选择开发人员而不是维护人员的位置是一个问题。
选择维护者解决了这个问题。
这个问题的简单解决方案是与在gitlab中拥有所有者角色的人进行快速聊天。他可以将一个文件推为READ。Md或者类似的开头。之后,一切都将像之前一样工作。
替代解决方案,使用GitLab 13.11(2021年4月)
Force push option for protected branches It’s best practice to prevent force push on Git repos, but exceptional cases may occasionally require it. Temporarily removing branch protections in order to conduct a force push may not always be ideal as it requires maintainer access, and causes the settings for branch protection to be lost. GitLab 13.11 introduces a new Allow force push setting for protected branches, which enables users in the Allowed to push list to force push. See Documentation and Issue.