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

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

问题描述

我正在尝试推送到 repo 的 master 分支,但我没有这样做,因为它受到保护.
我试图查看项目设置,但没有看到受保护分支的任何选项.我能看到的唯一选择是会员.

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.

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

Please suggest how to push code to master branch.

推荐答案

目前还没有内容

这意味着还没有要保护的 master 分支,因为空的 repo 没有.

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

"启用/禁用分支保护",你需要是Master或 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天全站免登陆