我是 GitHub 的新手.今天我在尝试将我的代码推送到 GitHub 时遇到了一些问题。
Pushing to git@github.com:519ebayproject/519ebayproject.git
To git@github.com:519ebayproject/519ebayproject.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:519ebayproject/519ebayproject.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
我还没有在存储库中推送任何东西,那么为什么我需要 pull 一些东西?
最佳答案
This can cause the remote repository to lose commits; use it with care.
如果您不想将远程分支 merge 到您的本地分支(请参阅与 git diff 的区别),并且想要强制推送,请使用 push command with -f
git push -f origin <branch>
其中 origin
是您的 remote 的名称 repo 。
Usually, the command refuses to update a remote ref that is not an ancestor of the local ref used to overwrite it. This flag disables the check. This can cause the remote repository to lose commits; use it with care.
关于git - 无法推送到 GitHub - 一直说需要 merge ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10298291/