有时候作为非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. SpringBoot配置双数据源

    SpringBoot配置双数据源 一.搭建springboot项目 二.添加依赖 <dependencies> <!--web服务--> <dependency> ...

  2. Unity3d 动画转换中断

    翻译自https://blogs.unity3d.com/2016/07/13/wait-ive-changed-my-mind-state-machine-transition-interrupti ...

  3. tomcat8 无法解析 请求url 中 包含 [: 或者 :] 等特殊符号

    使用如下URL: http://127.0.0.1:8080/xx/[:xOGxeSSk5ENaYh89ziEFJA==:].do 如果使用tomcat8 无法正常访问,浏览器network 报错 4 ...

  4. HDLbits——Mt2015 lfsr

    1.描述电路图里面的一个子模块 Assume that you want to implement hierarchical Verilog code for this circuit, using ...

  5. Node.js实现国密算法

    一.node.js环境安装 1 去官网下载压缩包,并放置到/usr/local/bin文件夹下 2 进行环境变量配置 vim /etc/profile 在环境变量文件的末尾添加 export NODE ...

  6. windows下判断程序是否内存泄漏

    在main函数第一行写 _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); 程序退出后如果有泄漏会有打印

  7. 在子组件中使用$parent获取不到父组件里的变量值?

    一直用的都是this.$parent来取父组件的值,现在发现,element-UI内的组件,也是一层父组件 例如 父组件内 子组件内   console.log 打印结果

  8. Java流程控制之break、continue、goto

    break.continue break在任何循环语句的主体部分,均可用break控制循环的流程.break用于强行退出循环,不执行循环中剩余的语句.(break语句也在switch语句中使用) co ...

  9. Java流程控制之Scanner的进阶使用

    Scanner的进阶使用 import java.util.Scanner; public class Demo04 { public static void main(String[] args) ...

  10. python下载.msg文件的附件

    .msg文件,outlook邮件的一种保存方式 方式一:使用win32com库,不过要安装outlook才行 import win32com.client import os def get_atta ...