gitlab - 远程 : GitLab: You are not allowed to push code to protected branches on this project

标签 gitlab git-push

我正在尝试推送到存储库的主分支,但我失败了,因为它受到保护。
我尝试查看项目设置,但没有看到任何 protected 分支的选项。我能看到的唯一选择是成员(member)。

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'

我的仓库只有一个分支,目前还没有任何内容。
我确实看到了其他存储库的 protected 分支选项,但没有看到此特定存储库的 protected 分支选项。
这是一个新的存储库,没有任何内容,只有默认分支。
我拥有master权限。
不幸的是,我无法以某种方式在这里上传图像。

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

最佳答案

2018年12月17日

1。 git push:“错误:无法将一些引用推送到”

git push: error: failed to push some refs to

git push -f:“远程拒绝”

git push -f: remote rejected

2。该分支处于 protected 状态,无法强制运行。

Gitlab - 存储库 - 分支

Gitlab - Repository - Branches

3。暂时删除分支保护。

Gitlab - 设置 - 存储库 - protected 分支 - 取消保护

Gitlab - Settings - Repository - Protected Branches - Unprotect

4。再次尝试推送

git push -f

git push -f

5。可以添加保护

关于gitlab - 远程 : GitLab: You are not allowed to push code to protected branches on this project,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42073357/

相关文章:

gitlab - GitLab HTTP 远程上的 git 命令失败并显示 403

git:更改 "stash"以从远程仓库继续工作的最佳方法

git - 关于 git 强制推送

git push 在本地 gitlab 存储库上失败

git - 如何自动保持 2 个 git 存储库同步

npm - 从 gitlab 注册表获取 npm 包最新版本

docker - 通过 Gitlab CI/CD 将 docker 服务部署到自己的服务器的正确方法

rest - gitlab API : get all the project of a groups (with sub groups)

gitlab - 如何使用变量设置动态 gitlab 作业标签?

git - git push 是原子的吗?