我创建了一个Git仓库并上传了一些东西。后来,我为这个项目创建了一个新目录,并为它初始化了一个新的Git。现在我想推送更改并替换仓库中的旧内容。当我运行git push origin master
时,会得到以下结果:
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:Username/repo2.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again. See the 'Note about
fast-forwards' section of 'git push --help' for details.
我该怎么办才能解决这个问题?