解决failed to push some refs to git
使用git push -u origin master
报下面的错:
$ git push -u origin master
To gitee.com:hot_heart/billing_management_system.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@gitee.com:hot_heart/billing_management_system.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.
原因:
本地仓库和远程仓库存在具有时间差的commit
解决方案:
执行下面的命令(注:pull=fetch+merge)
$ git pull --rebase origin master
还没有评论,来说两句吧...