zoukankan      html  css  js  c++  java
  • 如何解决failed to push some refs to git...

           在使用git 对源代码进行push到gitHub时可能会出错,信息如下:

    ! [rejected]       master -> master (non-fast-forward)

    error: failed to push some refs to 'https://github.com......

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

      git push -u origin master

      但依然没能解决问题,出现错误的主要原因是github中的README.md文件不在本地代码目录中。

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

        git pull --rebase origin master

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

    然后再次:

      git push -u origin master

    问题解决!

  • 相关阅读:
    LeetCode 104
    LeetCode 100
    LeetCode 27
    LeetCode 7
    LeetCode 8
    蘑菇街2017春招笔试
    codeforces 5D
    codeforces 5C
    codeforces 875B
    codeforces 876B
  • 原文地址:https://www.cnblogs.com/gaoxinwu/p/7749553.html
Copyright © 2011-2022 走看看