图 1-1

报错:failed to push some refs to 'http://*******.git'。

一痛瞎踅摸之后,远程控制电脑,在H电脑上,重新建立了一个test项目,之后走正常流程:

echo "# 123" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin git@github.com:¥%…&&*@/.git
git push -u origin master

push成功没有问题,说明GitLab库级别配置,以及本地GitBash客户端没有问题。于是重新按照这个流程,本地新建文件夹,重新操作。

操作结果同上图1-1所示,失败了。

分析:

1.git clone下来没有问题,commit本地仓库没有问题,就是推不上去,初步怀疑这个项目的配置有问题(读写权限不一致)。

2.委托H同学询问其他同事能不能clone下他们的项目,然后提交上去,等待验证结果中。。。。。。

验证:

查看错误信息时候,发现酱紫的一句提示:“You are not allowed to push code to protected branches on this project.” ,发现了吗?这个项目的branch类型是“protected branches”!!!

紧接着,开始逛StackOverFlow,please pay attention:寻找问题的时候,最好的站点是StackOverflow!!!,效率最高的也是StackOverflow。Besides, attach the link:https://stackoverflow.com/questions/32246503/how-to-fix-you-are-not-allowed-to-push-code-to-protected-branches-on-this-proje 。

睁大眼睛:

there's no problem - everything works as expected.
      In GitLab some branches can be protected. By default only 'master' user can commit to protected branches. master branch is protected by default - it forces developers to issue merge requests to be validated by project master before integrating them into main code.
      You can turn on and off protection on selected branches in Project Settings (where exactly depends on GitLab version - see instructions below).
      On the same settings page you can also allow developers to push into the protected branches. With this setting on, protection will be limited to rejecting operations requiring git push --force (rebase etc.)

结合本文第一行的提示,公司新装的gitlab。GitLab一些分支默认被保护,仅仅拥有master级别的用户才能提交到保护分支,而且master分支默认是保护分支,其他用户需要通过合并issue请求来提交上去,靠!找到了。

Since GitLab 9.0
      Project: "Settings" -> "Repository" -> scroll down to "Protected branches".
      Now you can select who is allowed to merge or push into selected branches (for example: you can turn off pushes to master at all, forcing all changes to branch to be made via Merge Requests). Or you can click "Unprotect" to completely remove protection from branch.

如图:

(1)

(2)

总结:

1.定位问题是权限问题之后,就该把问题上报了,而且解决方案一并交给组长,是不是有很爽的感觉。

2.新装的gitLab,master分支默认protectd,这一点很坑啊!!!
---------------------
作者:暂7师师长常乃超
来源:CSDN
原文:https://blog.csdn.net/zzh920625/article/details/78087669
版权声明:本文为博主原创文章,转载请附上博文链接!

you are not allowed to push code to protected branches on this project(转)的更多相关文章

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

    "C:\Program Files\Git\bin\git.exe" push --recurse-submodules=check --progress "origin ...

  2. Git you are not allowed to push code to protected branches on this project?

    error: You are not allowed to push code to protected branches on this project....error: failed to pu ...

  3. git报错_you are not allowed to push code to protected branches on this project

    问题描述 今天在提交代码的时候,由于使用的是新库,写完代码后,进行push,发现报错 you are not allowed to push code to protected branches on ...

  4. 【错误解决】git报错:you are not allowed to push code to protected branches on this project

    场景回忆: 本地修改需要退回到之前的版本,打算强制push本地版本覆盖远程版本,但是在git push --force后出现了以下的错误: Fix GitLab error: "you ar ...

  5. GitLab: Deploy keys are not allowed to push code.

    被这个问题坑了,大半天.写此博文,愿入坑的童鞋能及时托坑 一.当你第一次pull或者push gitlab远程项目的时候提示你一个该建立一个sshkey,此时你在客户端生成sshkey 二.切记要把这 ...

  6. git报错You are not allowed to force push code to a protected branch on this project

    当我们有时候回滚了代码,想强制push到远程仓库的时候, git push origin --force 会报如下错误: You are not allowed to force push code ...

  7. Operation not allowed for reason code "7" on table 原因码 "7"的解决

    对表进行任何操作都不被允许,提示SQLSTATE=57016 SQLCODE=-668 ,原因码 "7"的错误:SQL0668N Operation not allowed for ...

  8. SQL0668N Operation not allowed for reason code "3" on table "TEST". SQLSTATE=57016

    问题描述: 查询,操作表都报如下错误 SQL0668N  Operation not allowed for reason code "3" on table "TEST ...

  9. db2数据库表操作错误SQL0668N Operation not allowed for reason code "1" on table "表". SQLSTATE=57016的解决方法

    错误sql Operation not allowed for reason code "1" on table "MARKET.PURE_USER".. SQ ...

随机推荐

  1. 学习python的日常3

    python的一些高级特性: 切片(跟名字一样,把一个完整的东西选取一部分自己想要的去切下来):通过切片可以快速的去除一些元素,只要确定好索引位置,避免的循环导致的多写代码 数组,元组,字符串都可以用 ...

  2. web-mini框架的基本实现(一)

    本篇主要介绍WSGI-web-mini框架的基本实现,以及什么是WSGI协议.对于浏览器的资源请求服务端是如何处理的等相关知识: 一.浏览器资源请求 我们知道浏览器和web服务器之间是基于HTTP协议 ...

  3. java ArrayList的remove()方法的参数为int和Integer的问题

    ArrayList的父类List中,有2个remove重载方法: remove(int index) remove(Object o) 假如参数输入为数字类型,到底是删除值等于该数字的对象还是删除索引 ...

  4. String/StringBuffer

    1. 将String中的空格替换成 %20 public class ReplaceBlank { public static void main(String[] args) { String st ...

  5. 当安装、卸载件包时,出现依赖问题 error: Failed dependencies

    error: Failed dependencies:…… 依赖关系非常复杂,当你试图先安装任何一个包时都会出现这样的依赖关系错误,这时候你就应该强制安装了,我认为只要你把服务或软件需要的包都装上,强 ...

  6. 安装k8s,使用root帐号的初始化脚本

    现在稳定性差不多了.可以总结一下了. 真正使用时,有几个地方,还是确认一下,再正式运行吧. #!/bin/bash # Version V0. ---: ;fi K8S_VERSION="1 ...

  7. CDH6.2离线安装(整理版)

    1.概述 CDH,全称Cloudera's Distribution, including Apache Hadoop.是Hadoop众多分支中对应中的一种,由Cloudera维护,基于稳定版本的Ap ...

  8. oracle删除重复数据,只保留一条

    比如,某个表要按照id和name重复,就算重复数据 delete from 表名 where rowid not in (select min(rowid) from 表名 group by id,n ...

  9. goto语句——慎用,但是可以用

    最近使用了goto语句,是因为if嵌套太深了,因此把错误处理同意了,直接使用goto语句. 举例: #include <stdio.h> int main () { /* local va ...

  10. koa2-router中间件来请求数据获取

    原理 虽然不使用中间件也能获取请求数据 对于POST请求的处理,koa-bodyparser中间件可以把koa2上下文的formData数据解析到ctx.request.body中. 安装koa2版本 ...