Github中的快进错误

Github中的快进错误,git,github,fast-forward,Git,Github,Fast Forward,作为在线课程的一部分,我刚刚接触git 当前正在学习教程,当我第一次按下master时收到以下错误消息: $ git push -u origin master To https://github.com/-/myappsample.git ! [rejected] master -> master (fetch first) error: failed to push some refs to 'https://github.com/-/myappsample.git'

作为在线课程的一部分,我刚刚接触git

当前正在学习教程,当我第一次按下master时收到以下错误消息:

$ git push -u origin master
To https://github.com/-/myappsample.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/-/myappsample.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
我尝试了git pull,但也不起作用:

$ git pull https://github.com/-/myappsample.git master
From https://github.com/-/myappsample
 * branch            master     -> FETCH_HEAD
fatal: refusing to merge unrelated histories
这是一个全新的Github帐户,具有新的/空的回购协议

有没有关于什么地方出了问题以及如何解决这个问题的想法


感谢

当远程存储库已更新,而本地存储库试图将其新更改推送到远程存储库而不更新其内容时,就会出现上述问题

这个问题可以通过拉动来解决。您可以尝试以下任一或全部操作:

  • git pull——全部
  • git pull origin<您的分支机构名称>
  • git-pull——重基
  • 最后一个选项是最好的,因为它试图根据远程重新确定您的回购的基础,以防止额外的合并提交


    这里可以找到一个很好的例子。如果拉取后出现错误/冲突,您还需要解决它们。

    您确定克隆了此repo吗?谢谢,我的错误是使用README.md选项创建了repo,本教程中没有该选项。然后我做了一个“push-f”来覆盖它,但是多亏了你的回答,我现在也知道如何做一个重基了!