小编典典

rejected master -> master (non-fast-forward)

all

我正在尝试推送我的项目(新存储库中的所有文件)。我按照这些步骤进行操作,但是当我推动时出现git push -u origin master此错误:

! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:asantoya/projectnewbies.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.

我多次收到此错误,无法弄清楚该怎么做。


阅读 96

收藏
2022-04-27

共1个答案

小编典典

正如错误消息所说:git pull在你尝试之前git push。显然您的本地分支与您的跟踪分支不同步。

根据项目规则和您的工作流程,您可能还想使用git pull --rebase.

2022-04-27