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

在push代码时,遇到这种问题Updates were rejected because the tip of your current branch is behind

(更新被拒绝,因为当前分支的尖端落后)

解决

有三种方案

  1. push前先将远程repository修改pull下来
git pull origin master
git push -u origin master
  1. 使用强制push的方法:
git push -u origin master -f

这样会使远程修改丢失,一般是不可取的,尤其是多人协作开发的时候。

  1. 若不想merge远程和本地修改,可以先创建新的分支:
git branch [name]
#然后push
git push -u origin [name]

衍生问题

使用上述方法在pull时可能会遇到如下问题

1.git pull 提示refusing to merge unrelated histories

这个有解决办法

2.There is no tracking information for the current branch(没有当前分支的跟踪信息)

是因为本地分支和远程分支没有建立联系

(使用git branch -vv 可以查看本地分支和远程分支的关联关系,查看远程分支 git remote -v)

解决方法:

1)是直接指定远程master:

git pull origin master

​2)另外一种方法就是先指定本地master到远程的master,然后再去pull:

git branch --set-upstream-to=origin/远程分支的名字  本地分支的名字
git pull

关于git remote可以看看这篇文章

Git错误,Updates were rejected because the tip of your current branch is behind的更多相关文章

  1. (转)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] ...

  2. 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 ...

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

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

  4. 【git报错】hint: Updates were rejected because the tip of your current branch is behind

    有时候作为非master权限的项目参与者 在push的时候会遇到这样的报错: hint: Updates were rejected because the tip of your current b ...

  5. [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 ...

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

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

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

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

  8. 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 ...

  9. 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 ...

  10. 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 ...

随机推荐

  1. oracle goldengate for downstreams 配置--for 数据库参数配置和ogg进程参数配置

    1.整体数据库配置三个源端和一个downstream下游抽取数据库配置:alter system set enable_goldengate_replication=TRUE;Alter databa ...

  2. SPICE协议浅析

    本文分享自天翼云开发者社区<SPICE协议浅析>,作者:王****均 云环境中根据使用场景不同,有多种远程控制台传输协议,如SPICE.VNC.RDP等. SPICE是Simple Pro ...

  3. Vegeta HTTP 负载测试工具

    Go接口压测的第三方包,一个很好用的负载测试工具.vegeta测试工具组件(可执行文件)支持linux以及mac系统,这里指的是通过终端命令行进行进行测试,不需要从代码层面使用这个工具的时候支持lin ...

  4. Q:Win10关闭内存压缩功能

    微软在Win10中就已经启用了内存压缩机制,在Win11当中继续了这一设定. 通过任务管理器查看. taskmgr ·通过命令行查看. 使用系统管理员权限,打开PowerShell,然后输入以下命令: ...

  5. Linux环境下安装phantomjs

    一.创建文件夹,用来存放软件 cd /opt/softWare mkdir  phantomJS cd phantomJS 二.下载并解压 wget https://bitbucket.org/ari ...

  6. c/c++ 2019公司面试题目录

    原文作者:aircraft 原文链接:https://www.cnblogs.com/DOMLX/p/12131500.html c++面试题中经常被面试官面试的小问题总结(一)(本篇偏向基础知识) ...

  7. SignalR 外部调用自定义Hub类的方法,Clients为null

    这是因为外部调用的类的对象和你连接的Hub类的对象,这两个对象 不!一!样! 解决方法 在自定义的Hub类中,注入IHubContext对象,然后在方法中调用IHubContext对象来向前端推送数据 ...

  8. OpenLayers 绘制带箭头的LineString

    <!--******************************************************************** * Copyright 2000 - 2022 ...

  9. 6. MySQL 索引的数据结构(详细说明)

    6. MySQL 索引的数据结构(详细说明) @ 目录 6. MySQL 索引的数据结构(详细说明) 1. 为什么使用索引 2. 索引及其优缺点 2.1 索引概述 3. InnoDB中索引的推演 3. ...

  10. xpath 定位表格里面内容

    向上找页面唯一元素,依次为: 表格体/第一行/第14列 实现代码 Xpath==//tbody/tr[1]/td[11]