• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
可樂_Thompson
博客园    首页    新随笔    联系   管理    订阅  订阅
【已解决】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网站上也就可以看到对应文件了。。

posted on 2020-03-09 11:20  可樂_Thompson  阅读(795)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3