zoukankan      html  css  js  c++  java
  • 【已解决】github中git push origin master出错:error: failed to push some refs to

    今天上午写项目的时候在git的时候出现了这样的错误:

    Administrator@PC-20131018OHXV /cygdrive/e/dev_root/git/crifanLib
    $ git remote add origin https://github.com/crifan/crifanLib.git
    
    Administrator@PC-20131018OHXV /cygdrive/e/dev_root/git/crifanLib
    $ git remote -v
    origin  https://github.com/crifan/crifanLib.git (fetch)
    origin  https://github.com/crifan/crifanLib.git (push)
    
    Administrator@PC-20131018OHXV /cygdrive/e/dev_root/git/crifanLib
    $ git push origin master
    Username for 'https://github.com':
    Password for 'https://admin@crifan.com@github.com':
    To https://github.com/crifan/crifanLib.git
     ! [rejected]        master -> master (non-fast-forward)
    error: failed to push some refs to 'https://github.com/crifan/crifanLib.git'
    To prevent you from losing history, non-fast-forward updates were rejected
    Merge the remote changes (e.g. 'git pull') before pushing again.  See the
    'Note about fast-forwards' section of 'git push --help' for details.

    出错了。

    很明显是:

    本地没有update到最新版本的项目(git上有README.md文件没下载下来)

    本地直接push所以会出错。

    搜:

    error: failed to push some refs to

    http://stackoverflow.com/questions/24114676/git-error-failed-to-push-some-refs-to

    Administrator@PC-20131018OHXV /cygdrive/e/dev_root/git/crifanLib
    $ git pull --rebase origin master
    From https://github.com/crifan/crifanLib
     * branch            master     -> FETCH_HEAD
    First, rewinding head to replay your work on top of it...
    Applying: add local crifanLib to github

    可以看到,此时已经把github上最新的文件下载下来了:

    接着再去:

    git push origin master

    Administrator@PC-20131018OHXV /cygdrive/e/dev_root/git/crifanLib
    $ git push origin master
    Username for 'https://github.com':
    Password for 'https://crifancrifancrifan@github.com':
    Counting objects: 19, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (14/14), done.
    Writing objects: 100% (18/18), 112.33 KiB, done.
    Total 18 (delta 0), reused 0 (delta 0)
    To https://github.com/crifan/crifanLib.git
       6bae951..32d67c7  master -> master

    即可成功把本地的文件都上传到github上面去了。

    此时再去github网站上也就可以看到对应文件了。。

  • 相关阅读:
    UVa 10118 记忆化搜索 Free Candies
    CodeForces 568B DP Symmetric and Transitive
    UVa 11695 树的直径 Flight Planning
    UVa 10934 DP Dropping water balloons
    CodeForces 543D 树形DP Road Improvement
    CodeForces 570E DP Pig and Palindromes
    HDU 5396 区间DP 数学 Expression
    HDU 5402 模拟 构造 Travelling Salesman Problem
    HDU 5399 数学 Too Simple
    CodeForces 567F DP Mausoleum
  • 原文地址:https://www.cnblogs.com/Ky-Thompson23/p/12447451.html
Copyright © 2011-2022 走看看