首页 > 其他 > 详细

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

时间:2019-09-14 17:41:59      阅读:89      评论:0      收藏:0      [点我收藏+]

  刚开始学习 git 命令,发现会出现很多的错误,所以就总结下出现的错误,以此来加深理解和掌握吧!

 

环境:在本地库操作了一系列的 add 和 commit 操作后,想把本地仓库推送到远端,但是发生以下错误:

错误情况:Updates were rejected because the tip of your current branch is behind

技术分享图片

 

错误原因:我在远端 github 的版本库创建页面点击创建 README.md 按钮创建了说明文档,但是没有 pull 到本地,这样就产生了版本冲突问题。

解决方法

1,使用强制 push 的方法:

# 该方法会使远程修改丢失,一般是不可取的,尤其是多人协作开发的时候
$ git push -u origin master -f

2,push 前先将远程 repo 修改 pull 下来

# 先 pull 下来,在次进行推送到远端
$ git pull origin master
$ git push -u origin master

 

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

原文:https://www.cnblogs.com/zpcoding/p/11519475.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!