有时候作为非master权限的项目参与者

在push的时候会遇到这样的报错:

hint: Updates were rejected because the tip of your current branch is behind

由于push的操作,本质上是用本地的最新版本,去覆盖远程仓库中某个分支的上一个版本,一般默认是master分支

此时就会由于不具备操作master分支的权限而报这个错误

解决方法很简单:

1)像很多帖子说的一样加一个强制参数-f

git push -u origin master -f

但这个是很危险的,因为会覆盖掉受保护的master分支

所以推荐以下做法

2)新建一个分支

git branch [new_branch_name]

然后push给这个新的branch

【git报错】hint: Updates were rejected because the tip of your current branch is behind的更多相关文章

  1. Git 报错:Updates were rejected because the tip of your current branch is behind

    刚开始学习 git 命令,发现会出现很多的错误,所以就总结下出现的错误,以此来加深理解和掌握吧! 环境:在本地库操作了一系列的 add 和 commit 操作后,想把本地仓库推送到远端,但是发生以下错 ...

  2. git提交报错:Updates were rejected because the tip of your current branch is behind

    提交代码push时报错:上网查询了一下解决办法有很多种,1.使用强制push的方法:(上网查询说这种会使远程修改丢失,一般是不可取的,尤其是多人协作开发的时候.) git push -u origin ...

  3. git push ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://github.com/Operater9/guest' hint: Updates were rejected because the tip of your current bra

    推送本地代码到github报错 git push报错 ! [rejected] master -> master (non-fast-forward) error: failed to push ...

  4. [git] Updates were rejected because the tip of your current branch is behind its remote counterpart.

    场景 $ git push To https://github.com/XXX/XXX ! [rejected] dev -> dev (non-fast-forward) error: fai ...

  5. (转)Updates were rejected because the tip of your current branch is behind

    刚创建的github版本库,在push代码时出错: $ git push -u origin masterTo git@github.com:******/Demo.git ! [rejected] ...

  6. 01_第一次如何上传GitHub(转)Updates were rejected because the tip of your current branch is behind

    https://www.cnblogs.com/code-changeworld/p/4779145.html 刚创建的github版本库,在push代码时出错: $ git push -u orig ...

  7. 报错 hint: Updates were rejected because the remote contains work that you do 解决方法

    1. git pull origin master --allow-unrelated-histories 2.git pull origin master 3.git init 4.git remo ...

  8. git push时报错:Updates were rejected because the tip of your current branch is behind

    出现这样的问题是由于:自己当前版本低于远程仓库版本 有如下几种解决方法: 1.使用强制push的方法: git push -u origin master -f 这样会使远程修改丢失,一般是不可取的, ...

  9. git提交时报错:Updates were rejected because the tip of your current branch is behind

    有如下3种解决方法: 1.使用强制push的方法:git push -u origin master -f这样会使远程修改丢失,一般是不可取的,尤其是多人协作开发的时候. 2.push前先将远程rep ...

  10. Updates were rejected because the tip of your current branch is behind 问题出现解决方案

    提供如下几种方式: 1.使用强制push的方法(多人协作时不可取): git push -u origin master -f 2.push前先将远程repository修改pull下来 git pu ...

随机推荐

  1. git lock fail解决

    本地多个分支,remote .remote tracking.local checkout了2个不同版本分支,发现最后版本却是相同的,然后pull时报git lock fail, 看来发送了冲突了,删 ...

  2. STM32F0使用LL库实现UART接收

    初始化: 1 void MX_USART1_UART_Init(void) 2 { 3 4 /* USER CODE BEGIN USART1_Init 0 */ 5 6 /* USER CODE E ...

  3. .Net Core WebApi AutoFac用法

    1. 安装Autofac.Extensions.DependencyInjection管理包 UI层安装 2.在Program里面配置服务提供工厂 3.在Startup里面添加一个配置容器的方法 使用 ...

  4. ref、reactive、toRef、toRefs使用与区别

    reactive 传参:reactive(arg),arg只能是对象 arg为普通对象 返回响应式对象,不管层级多深,都能响应 使用:获取数据值的时候直接获取,不需要加.value 特点:解构.扩展运 ...

  5. JDBC之Driver和DriverMananger

    JDBC之Driver和DriverMananger 目录 JDBC之Driver和DriverMananger Java和MySQL的关系 JDBC 演变过程 驱动加载入内存的过程 Oracle加载 ...

  6. map函数中调用多个async await请求出现的promise问题解决

    以上这个打印会返回[promise,promise,promise]那么是什么原因造成的呢?我们先来一个方法解决: 但是以上这种解决方式并没有真正解决问题,还是会返回一个[promise,promis ...

  7. React如何修改props && 子组件调用父组件方法

    /** * 子组件如何更改父组件的state呢? * 父组件传递下来的props不满足要求,往往需要修改 * * * Author: shujun * Date: 2020-10-25 */ impo ...

  8. 【SQL Server】存储过程带参数输出——output

    在SQL Server 中,如果要用一个存储过程返回字符串应该怎么做?用output参数. 错误方式 接下来,展示一下,常见的错误方法 CREATE PROCEDURE testString AS B ...

  9. TypeScript - 继承(extends) - 抽象类(abstract)

    (function () { /** * abstract 开头的是抽象类, * 抽象类和其他区别不大,只是不能用来创建对象 * 抽象类专门是让别人继承的的类 */ abstract class An ...

  10. vue.js与webpack有什么关系?

    webpack是一个前端打包和构建工具.如果你之前一直是手写HTML,CSS,Javascript并且通过link标签将CSS引入你的HTML文件,以及通过Script标签的src属性引入外部的JS脚 ...