【背景】

折腾:

【记录】将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 <repository> <refspec>').

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 = <nickname>

    merge = <remote-ref>

    [remote "<nickname>"]

    url = <url>

    fetch = <refspec>

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网站上也就可以看到对应文件了:

【注意】

此处注意到,此时所用的用户,是那个当前电脑的名词,很长的那个,而不是crifan:

那是因为之前那个:

【已解决】cygwin中用git去config配置用户名和邮箱出错:error: cannot run vi: No such file or directory

时,当时没有解决掉用户名的问题就去commit了。

所以用户名是当时的,当前电脑的用户名。而不是我自己的crifan。

而此时已经解决了修改用户名的问题。

等下次再去上传,或许可以把用户名变过来了。

Git遇到的一点错误的更多相关文章

  1. git push origin master、git pull出现如下错误

    git push origin master出现如下错误: Counting objects: , done. Writing objects: % (/), bytes, done. Total ( ...

  2. Git版本控制:Git冲突解决 相关错误总结

    http://blog.csdn.net/pipisorry/article/details/46958699 冲突处理 git push冲突处理 git push时出现冲突:! [rejected] ...

  3. 关于git上的一些错误信息

    如果输入$ Git remote add origin git@github.com:djqiang(github帐号名)/gitdemo(项目名).git 提示出错信息:fatal: remote ...

  4. git remote add origin错误

    如果输入$ Git remote add origin git@github.com:djqiang(github帐号名)/gitdemo(项目名).git 提示出错信息:fatal: remote ...

  5. git提交代码出现错误fatal: Unable to create '项目路径/.git/index.lock': File exists.

    git提交代码出现错误fatal: Unable to create '项目路径/.git/index.lock': File exists. 具体出错代码如下: 具体原因不详,在stackoverf ...

  6. [git 学习篇] git remote add origin错误

    http://blog.csdn.net/dengjianqiang2011/article/details/9260435 如果输入$ Git remote add origin git@githu ...

  7. Git学习之常见错误 git push 失败

    Git学习之常见错误 git push 失败 问题描述: git push Counting objects: , done. Delta compression using up to thread ...

  8. Git学习之常见错误 clone被拒绝

    Git学习之常见错误 问题: git clone 时 报错 Permission Denied (权限被拒绝). 解决方法: 需要把本地的公钥上传到服务器. 解决步骤: ①第一步,设置本地的git的用 ...

  9. git ,报403错误,完美解决方案

    首先命令行操作结果如下: root@zhiren-PowerEdge-T110-II:/zrun# git clone https://git.coding.net/xxxxxxxx/xxxx.git ...

随机推荐

  1. ubuntu中安装eclipse 分类: android ubuntu linux 学习笔记 2015-07-07 10:19 75人阅读 评论(0) 收藏

    上一篇说了安装jdk的事,于是趁热打铁,决定把eclipse也安装了. 下载这一系列就不用说了. 下载完成之后: 然后解压,解压之后文件剪切到/usr/software文件夹中,同时重命名为eclip ...

  2. sharepoint 模糊搜索

    看资料知道sharepoint中模糊搜索可以用FullTextSqlQuery,因此我们就可以业务需求进行模糊搜索的自定义开发,可惜前一段时间自己写了一个模糊搜索,发现了一个问题,暂不知道如何过滤管理 ...

  3. python 入门1

    python的历史 Python是一种解释型.面向对象.动态数据类型的高级程序设计语言. Python由Guido van Rossum于1989年底发明,第一个公开发行版发行于1991年. 像Per ...

  4. C#教程之打印和打印预览

    最近研究一了一下关于PDF打印和打印预览的功能,在此小小的总结记录一下学习过程. 实现打印和打印预览的方法,一般要实现如下的菜单项:打印.打印预览.页面设置. PrintDocument类 Print ...

  5. JDK自带方法实现RSA数字签名

    JDK 6只支持MD2withRSA, MD5withRSA, SHA1withRSA 其他的如SHA512withRSA需要第三方包支持,如BC(bouncy castle) --20151126 ...

  6. js--小结④

    举例子,一个demo.提醒自己经常性会在onclick 和function()这两个地方出错 onclick会输少一个字母 function会忘记输括号

  7. MVC 中的Areas支持

    在ASP.NET MVC 2中对于Area功能的增强,这样的增强是如何在同一个项目中更好地组织应用程序的? ASP.NET MVC 1.0时,如果我们要在一个项目中做自己网站的后台应用,而又保持URL ...

  8. sql server split函数

    --创建分割函数CREATE FUNCTION dbo.Split(@String varchar(8000),@Delimiter char(1))returns @temptable TABLE ...

  9. insert一句话实现插入一条数据并且返回这条数据的某列

    insert into [table] output inserted.columnName values();

  10. WampServer修改MySQL密码

    WampServer安装后密码是空的,需要设置一下 一般有两种方式: 一是通过phpMyAdmin直接修改: 二是使用WAMP的MySql控制台修改. 第一种: ①在phpMyAdmin界面中点击[用 ...