解决failed to push some refs to git

àì夳堔傛蜴生んèń 2022-05-22 09:16 269阅读 0赞

使用git push -u origin master报下面的错:

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

原因:
本地仓库和远程仓库存在具有时间差的commit

解决方案:
执行下面的命令(注:pull=fetch+merge)

  1. $ git pull --rebase origin master

发表评论

表情:
评论列表 (有 0 条评论,269人围观)

还没有评论,来说两句吧...

相关阅读