使用git更新远程仓库的时候报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.

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

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

  • 11
    点赞
  • 27
    收藏
    觉得还不错? 一键收藏
  • 8
    评论
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值