error: failed to push some refs to 'https://github.com/github账号/learn_git.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caus

  1. error: failed to push some refs to 'https://github.com/github账号/learn_git.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caus
  2.  

    此时很多人会尝试下面的命令把当前分支代码上传到master分支上。

    $ git push -u origin master

    但依然没能解决问题

    error: failed to push some refs to 'https://github.com/github账号/learn_git.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caus
  3.  

    出现错误的主要原因是github中的README.md文件不在本地代码目录中

    error: failed to push some refs to 'https://github.com/github账号/learn_git.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caus
  4.  

    可以通过如下命令进行代码合并【注:pull=fetch+merge]

    git pull --rebase origin master

    error: failed to push some refs to 'https://github.com/github账号/learn_git.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caus
  5.  

    执行上面代码后可以看到本地代码库中多了README.md文件

    error: failed to push some refs to 'https://github.com/github账号/learn_git.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caus
    error: failed to push some refs to 'https://github.com/github账号/learn_git.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caus
  6.  

    此时再执行语句 git push -u origin master即可完成代码上传到github

    error: failed to push some refs to 'https://github.com/github账号/learn_git.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caus
上一篇:前后端分离djangorestframework——权限组件


下一篇:VC++6.0打开文件出错的解决办法