hint: Updates were rejected because the tip of your current branch is behind
2018-01-30 20:44
537 查看
在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]
$ 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 behindhint: its remote counterpart.
- 【git】updates were rejected because the tip of your current branch is behind its remote counterpart
- push代码:Updates were rejected because the tip of your current branch is behind
- Updates were rejected because the tip of your current branch is behind
- git push 报错"Updates were rejected because the tip of your current branch is behind"
- Updates were rejected because the tip of your current branch is behind
- git error:Updates were rejected because the tip of your current branch is behind
- Updates were rejected because the tip of your current branch is behind
- updates were rejected because the tip of your current branch is behind its remote counterpart
- Git报错:Updates were rejected because the tip of your current branch is behind
- Updates were rejected because the tip of your current branch is behind
- Updates were rejected because the tip of your current branch is behind its remote counterpart.
- Updates were rejected because the tip of your current branch is behind
- git:rejected because the tip of your current branch is behind
- 解决 failed to push some refs to 'git@github.com:zle1992/head-first-java' hint: Updates were rejected because the tip of your curr
- err: git push.default Update were rejected because a pushed branch tip is behand remote
- git push updates were rejected because the remote contain works that you do not have
- 【问题处理】GIT删除主分支报错:[remote rejected] master (deletion of the current branch prohibited)
- 奇葩问题:This file could not be checked in because the original version of the file on the server was moved or deleted. A new version of this file has been saved to the server, but your check-in comments were not saved