问题: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. 【异步编程实战】如何实现超时功能(以CompletableFuture为例)

    [异步编程实战]如何实现超时功能(以CompletableFuture为例) 由于网络波动或者连接节点下线等种种问题,对于大多数网络异步任务的执行通常会进行超时限制,在异步编程中是一个常见的问题.本文 ...

  2. java中的文件流File

    数据 + 流(转)操作 IO I表示的是:输入Input O表示的是:Output Stream表示流转 java中的管道不止一个.并且管道有可能不是一样的. 有的管道粗有的管道细 File的常用方法 ...

  3. 安全可信 | 天翼云自研密钥管理系统(KMS)获得《商用密码产品认证证书》!

    近日,天翼云自研密钥管理系统(KMS)通过国家密码管理局安全性审查,符合GM/T 0051<密码设备管理 对称密钥管理技术规范>要求,获得由国家密码管理局商用密码检测中心颁发的<商用 ...

  4. Codeforces 1536B Prinzessin der Verurteilung 题解 [ 紫 ] [ 后缀自动机 ] [ 动态规划 ] [ 拓扑排序 ]

    Prinzessin der Verurteilung:最短未出现字符串的板子. 思路 考虑在 SAM 上 dp,定义 \(dp_i\) 表示从 \(i\) 节点走到 NULL 节点所花费的最少步数. ...

  5. P5384 [Cnoi2019] 雪松果树 题解

    传送门 前言 一年一度,生长在高山上的雪松果树又结果了. 第二天,雪松果树长成了一颗参天大树, 上面长满了雪松果. 求雪松果树生长周期 整活向题解. 奋力卡常 3h,纪念一下. 是的,我一个人的提交占 ...

  6. 并发编程 - 线程同步(七)之互斥锁Monitor

    通过前面对锁lock的基本使用以及注意事项的学习,相信大家对锁的同步机制有了大致了解,今天我们将继续学习--互斥锁Monitor. lock是C#语言中的关键字,是语法糖,lock语句最终会由C#编译 ...

  7. [BZOJ3514] [Codechef MARCH14] GERALD07加强版 题解

    名字感觉挺奇怪的. 考虑离线算法.首先答案就是用 \(n\) 减去连完边后的生成树森林边数.生成树当然就可以用 \(lct\) 求解了.我是不会告诉你这个时候我已经开始想回滚莫队了的. 考虑当我们倒序 ...

  8. [WC2006] 水管局长 题解

    最大值最小的路径肯定在最小生成树上,考虑用 \(LCT\) 维护最小生成树,只需要维护长度最长的边即可实现.由于 \(LCT\) 维护最小生成树不支持删边,所以采用倒序加边的方式处理. 时间复杂度 \ ...

  9. Jsmoke-一款强大的js检测工具,浏览器部署即用,使用方便且高效

    Jsmoke by Yn8rt ​ 该插件由 Yn8rt师傅 开发,插件可以理解为主动版的hae和apifinder,因为其中的大多数规则我都引用了,当你认为当前页面,以及其调用的js文件存在敏感信息 ...

  10. VMware15.5虚拟机下载及安装

    一.VMware虚拟机介绍 VMWare虚拟机软件是一个"虚拟PC"软件,它使你可以在一台机器上同时运行二个或更多Windows.DOS.LINUX系统.与"多启动&qu ...