【背景】

折腾:

【记录】将googlecode上面的crifanLib迁移到Github上

期间出错:

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

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所以会出错。

【解决过程】

1.看到提示里面,感觉是本地的代码不是最新的。

所以觉得应该是类似于svn中的,先update一下,再去commit,估计就可以了。

所以先去pull试试:

结果直接pull好像是不对的:

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

Administrator@PC-20131018OHXV  /cygdrive/e/dev_root/git/crifanLib

$ git pull

warning: no common commits

remote: Counting objects: 6,  done .

remote: Total 6 (delta 0), reused 0 (delta 0)

Unpacking objects: 100% (6 /6 ),  done .

From https: //github .com /crifan/crifanLib

  * [new branch]      master     -> origin /master

You asked me to pull without telling me  which  branch you

want to merge with, and  'branch.master.merge'  in

your configuration  file  does not tell me, either. Please

specify  which  branch you want to use on the  command  line and

try again (e.g.  'git pull ' ).

See git-pull(1)  for  details.

If you often merge with the same branch, you may want to

use something like the following  in  your configuration  file :

     [branch  "master" ]

     remote =

     merge =

     [remote  "" ]

     url =

     fetch =

See git-config(1)  for  details.

看来需要先搞懂pull的用法。

2.估计是指定对应的要pull的目标即可。

所以再去试试pull origin:

?

1

2

3

4

5

Administrator@PC-20131018OHXV  /cygdrive/e/dev_root/git/crifanLib

$ git pull origin

You asked to pull from the remote  'origin' , but did not specify

a branch. Because this is not the default configured remote

for  your current branch, you must specify a branch on the  command  line.

也还是不对。

有空再继续搞懂原理后再弄。。

3.搜:

error: failed to push some refs to

参考:

github – git error: failed to push some refs to – Stack Overflow

去试试:

?

1

2

3

4

5

6

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上最新的文件下载下来了:

即,那个README.md文件。

4.接着再去:

git push origin master

?

1

2

3

4

5

6

7

8

9

10

11

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上面去了。

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

【已解决】github中git push origin master出错:error: failed to push some refs to(亲测)相关推荐

  1. git push出现 ! [rejected] master - master (non-fast-forward)error failed to push some refs to

    git push出现 ! [rejected] master -> master (non-fast-forward)error: failed to push some refs to 错误提 ...

  2. git上传本地工程到码云上,报错: ! [rejected] master - master (non-fast-forward) error: failed to push some

    git上传本地工程到码云上,报错: fushaolei@DESKTOP-50PGGOT MINGW64 /f/teach/xcEdu/xcEduUI01/xc-ui-pc-static-portal ...

  3. 已解决selenium框架接管已经打开的谷歌浏览器(Python反反爬教程,亲测有效)

    已解决selenium框架接管已经打开的谷歌浏览器(Python反反爬教程,亲测有效) 文章目录 问题描述 解决方法 千人全栈VIP答疑群联系博主帮忙解决报错 问题描述 使用selenium自动化测试 ...

  4. git push origin master 出错

    文章目录 问题描述 解决办法 原因 参考链接 问题描述 在本地commit项目后,使用命令git push origin master出现错误: 报错"master -> master ...

  5. git仓库报错【 ! [rejected] master -> master (non-fast-forward)error: failed to push some refs to】

    第一次提交出现此问题,报错的原因是因为远程仓库有的文件在本地仓库中没有,如下显示: 解决方法一:(推荐) git pull --rebase origin master  <本地生成ReadMe ...

  6. 【Git】push 分支报错 error: failed to push some refs to...

    文章目录 报错消息 解决方法 报错消息 示例图: 示例代码: ➜ fisher git:(test) git push origin test To git.woa.com:wxg-bigdata/f ...

  7. git push报错:error: failed to push some refs to ‘https:/

    解决在git push时的报错:error: failed to push some refs to 'https:/ // 错误如下 hint: Updates were rejected beca ...

  8. [rejected] master -> master (non-fast-forward) error: failed to push some refs to

    报错截图 本地创建了一个project 并在码云上创建了一个仓库,想要将本地的仓库链接到远程仓库 我用的是如下方法: git init    初始化本地仓库 git remote add origin ...

  9. 解决办法:git错误 error: failed to push some refs to 'https://github.com/...

    问题描述: 今天在git bash中键入 $ git push origin master 进行提交的时候出现出现了 如下错误: ! [rejected] master -> master (n ...

最新文章

  1. 2、掌握C++基本语法
  2. Minimum Extraction 思维
  3. C++Primer:Break、Continue、Goto、Try/异常处理
  4. iPhone 12不标配充电器后,国产手机配件成了国外抢手货!
  5. NVisionXR_iOS教程五 —— 添加灯光渲染
  6. Sqoop 使用指南
  7. 高级I/O复用技术:Epoll的使用及一个完整的C实例
  8. (一)人工智能、AI批量抠图、AI视频抠像、图片换背景、视频换背景、实时抠图、实时抠像、虚拟场景直播系统、虚拟旅游、人像去背景、图像去背景、视频背景消除
  9. 爱特php文件管理器2.8_爱特全能网站文件专家
  10. Rsoft光波导软件基于七芯光纤波导耦合器模拟
  11. asp.net实现MD5加密
  12. 产品经理 - 产品设计方法论业务落地部分_包括流程产品文档方法论需求设计方法论
  13. 设备通过国标GB28181/海康Ehome接入EasyCVR,视频无法打开的原因分析及解决方法
  14. 国产化适配之人大金仓数据库(三)项目适配
  15. 使用cmake安装nuget
  16. 阿里都在用的线上问题定位工具【收藏备用】
  17. 指纹传感器的测试软件,【Arduino】168种传感器系列实验(149)-AS608光学指纹识别模块-Arduino中文社区 - Powered by Discuz!...
  18. TCSVT2020:基于新型SAD计算的HEVC低功耗运动估计
  19. 直播、视频会议、屏幕共享—RTC实时音视频各大平台如何选择
  20. Novavax向世卫组织提交紧急使用申请;pHOXBIO公布新冠肺炎预防性鼻喷剂 | 医药健闻...

热门文章

  1. QT的QGraphicsAnchorLayout类的使用
  2. 计算机操作系统作业答案,计算机操作系统作业及答案
  3. python colorlist_Python list的常用操作
  4. 「SVN」ubuntu svn自动忽略了.a.so等文件
  5. spring boot 使用外部配置文件
  6. 分布式系统概述(来自学习资料)
  7. Centos中git的安装
  8. Java调用.NET的WCF
  9. oracle字符串清洗、拆分案例
  10. Kettle使用_6 配置资源库