! [remote rejected] develop -> develop (pre-receive hook declined)

文章讲述了在GitLab中遇到的gitpush到受保护develop分支失败的问题,原因是权限限制。解决方法包括创建新分支,确认切换,然后在远程仓库中通过合并请求将新分支合并到develop分支。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题

git push 远程提交dao develop 分支失败,出现下面错误信息

remote: GitLab: You are not allowed to push code to protected branches on this project.
To https://xxx.com.cn/xxx/xxx/xxx/xxx.git/
 ! [remote rejected] develop -> develop (pre-receive hook declined)
error: 无法推送一些引用到 'https://xxx.com.cn/xxx/xxx/xxx/xxx.git'

原因

remote: GitLab: You are not allowed to push code to protected branches on this project.

develop 分支是受保护的,不允许把代码上传到该分支

办法

# 创建一个新分支
git checkout -b new_branch_name
# 检查是否切换到新分支 new_branch_name
git branch
# 上传到远程
git push origin new_branch_name

上传成功后,会在远程仓库中新建一个分支(new_branch_name),进入远程仓库该分支下,会有一个“创建合并分支请求”的按钮,点击按钮发起一个合并分支的请求,将new_branch_name 分支合并到 develop 分支

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值