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

Posted zhucaipeng

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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 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的主要内容,如果未能解决你的问题,请参考以下文章

VS2019 github push失败: Updates were rejected because the tip of your current branch is behind

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

github每次创建新的项目都各种报错Updates were rejected because the remote contains work that you do

解决Jenkins的错误“The Server rejected the connection: None of the protocols were accepted”

解决 failed to push some refs to 'git@github.com:zle1992/head-first-java' hint: Updates were r

复盘BEC被盗事件,UDomain教你避免悲剧重演