问题
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 分支