刚创建的github版本库,在push代码时出错:

$ git push -u origin master
To git@github.com:******/Demo.git
 ! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:******/Demo.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

网上搜索了下,是因为远程repository和我本地的repository冲突导致的,而我在创建版本库后,在github的版本库页面点击了创建README.md文件的按钮创建了说明文档,但是却没有pull到本地。这样就产生了版本冲突的问题。

有如下几种解决方法:

1.使用强制push的方法:

$ git push -u origin master -f

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

2.push前先将远程repository修改pull下来

$ git pull origin master

$ git push -u origin master

3.若不想merge远程和本地修改,可以先创建新的分支:

$ git branch [name]

然后push

$ git push -u origin [name]

(转)Updates were rejected because the tip of your current branch is behind的更多相关文章

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

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

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

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

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

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

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

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

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

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

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

  9. 解决 failed to push some refs to 'git@github.com:zle1992/head-first-java' hint: Updates were rejected because the tip of your curr

    问题描述: 寒假之前用实验室电脑push到github 上head first java 的程序,寒假回家后,想用自己的笔记本继续编,继续push . 我先从github下载zip到本地,然后 解压后 ...

随机推荐

  1. web Worker基本使用

    web worker 使用 web worker 是现代浏览器具有的可以处理密集型任务非常便利的解决方案,众所周知,JavaScript是单线程的(一个JavaScript引擎实例只能占用一个线程,线 ...

  2. [C# 网络编程系列]专题八:P2P编程

    引言: 前面的介绍专题中有朋友向我留言说介绍下关于P2P相关的内容的,首先本人对于C#网络编程也不是什么大牛,因为能力的关系,也只能把自己的一些学习过程和自己的一些学习过程中的理解和大家分享下的,下面 ...

  3. Java Hotspot client模式和server模式的区别

    当虚拟机运行在-client模式的时候,使用的是一个代号为C1的轻量级编译器, 而-server模式启动的虚拟机采用相对重量级,代号为C2的编译器. C2比C1编译器编译的相对彻底,服务起来之后,性能 ...

  4. 如何从ERP将Material的Batch信息下载到CRM并存储在settype COMM_PR_BATCH里

    前提条件:必须先确保三个对象ATTRIBUTE, CLASS和OBJCL成功下载.可以到事物码R3AM1里查看,确保状态全部为Done. (1) 在事物码MM02里,切换到视图classificati ...

  5. Django Request 与Response对象

    Django使用请求和响应对象在系统中传递状态.当请求页面时,Django创建一个HttpRequest对象,该对象包含关于请求的元数据. 然后Django加载适当的视图,将HttpRequest作为 ...

  6. 【洛谷2709】小B的询问(莫队模板题)

    点此看题面 大致题意: 有一个长度为\(N\)的序列,每个数字在\(1\sim K\)之间,有\(M\)个询问,每个询问给你一个区间,让你求出\(\sum_{i=1}^K c(i)^2\),其中\(c ...

  7. Ural State University Internal Contest October'2000 Junior Session

    POJ 上的一套水题,哈哈~~~,最后一题很恶心,不想写了~~~ Rope Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7 ...

  8. CF25E Test

    嘟嘟嘟 因为只有三个字符串,所以就有一个比较暴力的做法:枚举这三个串所有排列,然后对于每一个排列,减去这三个串两两的公共部分的长度,更新答案. 求公共部分自然想到kmp:比如s[1]接在s[0]后面, ...

  9. POJ 1986 Distance Queries 【输入YY && LCA(Tarjan离线)】

    任意门:http://poj.org/problem?id=1986 Distance Queries Time Limit: 2000MS   Memory Limit: 30000K Total ...

  10. EJB3 调用的存储过程

    要调用存储过程,我们可以通过 EntityManager 对象的 createNativeQuery()方法执行 SQL 语句 (注意:这里说的是SQL 语句,不是 EJB3 QL), 调用存储过程的 ...