我目前所在的分支是my_branch
。 尝试将更改推送到远程存储库时,我收到以下错误信息:
$ git push
Counting objects: 544, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (465/465), done.
Writing objects: 100% (533/533), 2.04 MiB | 1.16 MiB/s, done.
Total 533 (delta 407), reused 0 (delta 0)
To git@......git
4ed90a6..52673f3 my_branch -> my_branch
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@......git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
尝试执行 git pull
后出现以下结果:
$ git pull
Already up-to-date.
我为什么会收到这个错误信息?
如何解决这个问题并成功执行git push
?
4ed90a6..52673f3 my_branch -> my_branch
表示my_branch
已经成功更新,但是! [rejected] master -> master (non-fast-forward)
表示主分支已经失败。这意味着 某些引用 未能推送到仓库,但是其他一些引用 可能 已经成功了,比如my_branch
。 - Ryan Bigg