我试图推动我的项目(所有文件在一个新的存储库)。我遵循这些步骤,但当我用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.
我得到这个错误很多次,不知道该怎么做。
这也可能是由于在给Repo命名时引起的一些名称错误造成的。
如果上面的任何一个答案都不起作用,下面这个对我来说是有效的:
删除该repo并创建一个新的repo,并再次尝试以下命令:
cd 'Local Directory Path'
git remote add origin *your_git_name.git*
git push -u origin master
如果add origin显示已经存在,则使用以下方法:
git remote set-url origin *your_git_name.git*
这也可能是由于在给Repo命名时引起的一些名称错误造成的。
如果上面的任何一个答案都不起作用,下面这个对我来说是有效的:
删除该repo并创建一个新的repo,并再次尝试以下命令:
cd 'Local Directory Path'
git remote add origin *your_git_name.git*
git push -u origin master
如果add origin显示已经存在,则使用以下方法:
git remote set-url origin *your_git_name.git*