当前位置:   article > 正文

使用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

版权声明:未经允许,随意转载,请附上本文链接谢谢(づ ̄3 ̄)づ╭❤~
https://blog.csdn.net/xiaoduan_/article/details/80904888

使用git更新远程仓库的时候报Updates were rejected because the tip of your current branch is behind错误

今天使用git更新GitHub仓库的时候出现了错误,具体错误如下

To github.com:Anthony-Duan/hbasetrain.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:Anthony-Duan/hbasetrain.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

错误原因其实是我本地没有README.md这个文件,而远程仓库中有,
如何解决那?
很简单
git pull --rebase origin master
执行这一句就行了
执行完后会发现本地已经有了 README.md 这个文件

然后就是常规操作了
git push -u origin master
之后就可以看到GitHub上已经有了刚上传的新鲜代码啦!

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/497680
推荐阅读
相关标签
  

闽ICP备14008679号