我试图将我的项目(所有文件)推送到一个新的代码库。我按照步骤进行,但是当我使用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.
我遇到过很多次这个错误,但无法弄清楚该怎么做。
git push --force <remote_repository>
对我有用。 - Sorter