Updates were rejected because the tip of your current branch is behind
2018-03-13 15:06
531 查看
现在本地建了一个库interview,然后在github创建同名仓库interview并加入readme.md文件,push时会报错。因为两个库内容不一样了。
网上搜索解决答案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 pull的时候依然报错fatal: refusing to merge unrelated histories因为他们是两个不同的项目,要把两个不同的项目合并,git需要添加一句代码,这句代码是在git 2.9.2版本发生的,最新的版本需要添加
网上搜索解决答案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 pull的时候依然报错fatal: refusing to merge unrelated histories因为他们是两个不同的项目,要把两个不同的项目合并,git需要添加一句代码,这句代码是在git 2.9.2版本发生的,最新的版本需要添加
--allow-unrelated-histories那么我们 需要这样写
git pull origin master ---allow-unrelated-histories
相关文章推荐
- updates were rejected because the tip of your current branch is behind its remote counterpart
- git push 报错"Updates were rejected because the tip of your current branch is behind"
- hint: 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 behindhint: its remote counterpart.
- 【git】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
- 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
- git error: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
- 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: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
- error: failed to push some refs to 'git@github.com:....." Updates were rejected because the remote c
- 【问题处理】GIT删除主分支报错:[remote rejected] master (deletion of the current branch prohibited)
- git push updates were rejected because the remote contain works that you do not have