远程:GitLab:不允许将代码推送到该项目上受保护的分支 [英] remote: GitLab: You are not allowed to push code to protected branches on this project

查看:1363
本文介绍了远程:GitLab:不允许将代码推送到该项目上受保护的分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于受保护,我试图将其推送到存储库的主分支,但未能这样做.
我试图查看项目设置,但看不到受保护分支的任何选项.我唯一看到的选择是成员.

I am trying to push to master branch of a repo and I am failing to do so, since it is protected.
I tried to look into the project settings and do not see any option for protected branches. The only option I could see is members.

remote: GitLab: You are not allowed to push code to protected branches on this project.
To git@gitlab.ins.risk.regn.net:cmd/release.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@gitlab.ins.risk.regn.net:cmd/release.git'

我的仓库只有一个分支,到目前为止没有内容.
我的确看到了我其他仓库的受保护分支选项,但没有看到该特定仓库的分支.
这是一个没有内容且只有默认分支的新回购.
我具有master权限.
不幸的是,我无法以某种方式上传图像.

My repo has only one branch, with no contents in it so far.
I do see protected branches options of my other Repos but not for this specific one.
It is a new repo with no contents and with only default branch.
I have the master permission.
Unfortunately I am not able to upload the image here somehow.

请建议如何将代码推送到master分支.

Please suggest how to push code to master branch.

推荐答案

目前为止没有内容

with no contents in it so far

这意味着尚无要保护的master分支,因为空存储库没有分支.

That means there is no master branch to protect yet, because the empty repo does not has one.

启用/禁用分支保护" ,您需要成为管理员或GitLab项目的所有者(就是您).

To "Enable/disable branch protection", you need to be Master or Owner of the GitLab project (which you are).

请确保:

  • your first push is a git push -u origin master;
  • the remote origin does reference the right repo (git remote -v);
  • your local ssh key is the right one (ssh -T git@gitlab.ins.risk.regn.net);
  • you are a member of the cmd group.

这篇关于远程:GitLab:不允许将代码推送到该项目上受保护的分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆