【发布时间】:2020-12-30 16:09:03
【问题描述】:
$ git push -u origin master
To https://github.com/XXXXXXXXX.com/FirstRepo.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/XXXXXXXXX.com/FirstRepo.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
我今天第一次使用 github,我已经检查了其他答案,其中只有一个似乎有效,那就是使用 'git push origin master --force',但这样做是删除所有其他提交。谁能告诉我解决方案。
【问题讨论】:
-
你先拉了吗?
-
您可以执行 git pull 来获取远程更改,然后您的推送应该可以工作
-
是的,我在推送之前这样做了,但它仍然给出了相同的提示。但是在提交期间它的显示如下“创建模式 100644 textfile.txt”
-
如果您先使用
git pull,听起来好像出了点问题。发布更多细节。显示您的步骤,显示输出,然后也许我们可以帮助您完成它。目前,任何人都能给出的最佳建议是“先使用git pull”,然后再推送。 -
你可以试试这个帖子:stackoverflow.com/questions/24114676/…
标签: git github push git-push git-pull