一,今天在上传代码时出错:

$ git push -u origin master
error: The requested URL returned error: 403 Forbidden while accessing https://github.com/freemao/Genotype-corrector.git/info/refs

fatal: HTTP request failed

解决办法:

$ git remote set-url origin https://freemao:freemao1234@github.com/freemao/Genotype-corrector.git

之前的url是:https://github.com/freemao/Genotype-corrector.git

相当于添加一下用户名和密码

git remote set-url 相当于是修改了配置文件.git/config 中的url

修改过以后,成功提交。

如果url中不添加密码,只添加用户名,可能会报下面错误:

(gnome-ssh-askpass:52175): Gtk-WARNING **: cannot open display:

二,我先修改了一个文件,然后将他重命名,在github上将原来的那个文件给删了。接下来我再push就报错了:

$ git push -u origin master
To https://freemao:freemao1234@github.com/freemao/Genotype-corrector.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://freemao:freemao1234@github.com/freemao/Genotype-corrector.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again. See the 'Note about
fast-forwards' section of 'git push --help' for details.

解决办法:

先pull一下:

$ git pull -f --all
Fetching origin
remote: Counting objects: 2, done.
remote: Compressing objects: 100% (1/1), done.
remote: Total 2 (delta 1), reused 2 (delta 1), pack-reused 0
Unpacking objects: 100% (2/2), done.
From https://github.com/freemao/Genotype-corrector
e94b6ee..960d781 master -> origin/master
Merge made by recursive.

再push:

$ git push -u origin master

OK了。

正确的改名字的方法:

先mv

然后 git add newname

git commit

git push

这个时候新文件被push了。但是老文件还在github上

接下来

git rm oldname

git commit

git push 这样就把老名字的文件在github上删除了

by freemao

FAFU

git error的更多相关文章

  1. Git error on commit after merge - fatal: cannot do a partial commit during a merge

    Git error on commit after merge - fatal: cannot do a partial commit during a merge this answer is : ...

  2. git: error while loading shared libraries: libiconv.so.2

    git安装之后出现:git: error while loading shared libraries: libiconv.so.2: cannot open shared object file: ...

  3. [git] git error: unable to unlink old

    今天git pull ,结果报错 :   git error: unable to unlink old 原因是   文件夹内 一个exe 处于打开状态. 哈哈哈哈,又是个低级错误~~~ 下次注意呀~

  4. git error: unable to create file Invalid argument

    git error: unable to create file xxxx  Invalid argument 原因: mac  上创建的文件名里有冒号,这在windows 上是不允许的. 解决方式: ...

  5. git error: unable to rewind rpc post data - try increasing http.postBuffer

    error: unable to rewind rpc post data - try increasing http.postBuffererror: RPC failed; curl 56 Rec ...

  6. 使用git error: RPC failed; result=22, HTTP code = 411

    使用git提交比较大的文件的时候可能会出现这个错误 error: RPC failed; result=22, HTTP code = 411 fatal: The remote end hung u ...

  7. git error: Your local changes to the following files would be overwritten by merge:xxxxxx ,Please commit your changes or stash them before you merge.的phpstorm解决办法

    git报错 error: Your local changes to the following files would be overwritten by merge: .idea/encoding ...

  8. 【Git】git error记录之 "unpacking the sent packfile failed on the remote"

    错误信息: error: cannot open .git/FETCH_HEAD: Permission denied unpacking the sent packfile failed on th ...

  9. git error: RPC failed; curl 56 GnuTLS recv error 解决方案

    // git 报错情况: error: RPC failed; curl 56 GnuTLS recv error (-110): The TLS connection was non-properl ...

随机推荐

  1. 单元测试:查找list[]中的最大值

     原始代码如下: int Largest(int list[], int length) { int i,max; for(i = 0; i < (length – 1); i ++ ) { i ...

  2. ubuntu 到底是选择32位还是64位?

     ubuntu 到底是选择32位还是64位? 2011-06-03 15:16:31 标签:ubuntu linux 休闲 cpu 职场 原文出处:官方wiki原文作者:授权许可: 创作共用协议Att ...

  3. 01-C语言概述

    本文目录 一.C语言简史 二.C语言的特点 三.C语言能做什么? 四.C语言的版本问题 五.C语言语法预览 回到顶部 一.C语言简史 C语言于1972年发明,首次使用是用于重写UINX操作系统(UNI ...

  4. CSS 3 选择器

    css3叫做样式表  对页面的布局,字体,颜色,背景和其他效果做更精确的布置 支持的浏览器有 chrome safari firfox opera 甚至360都开始支持360用的是别的内核 IE10 ...

  5. Gradle version 2.2 is required. Current version is 2.14.1.

    gradle版本错误: 1. 修改gradle\wrapper\gradle-wrapper.properties文件: distributionUrl=https\://services.gradl ...

  6. git diff patch

    如何生成patch:修改一个地方,然后git diff > xxx.patch 就会生成一个patch文件,这里的关键似乎是, 源文件的某个模块的版本要和线上发布的最新版本要一致,这样patch ...

  7. Android平板上开发应用的一点心得——精确适配不同的dpi和屏幕尺寸

    一.引言 Android的开源使厂商无需自行研发OS,大大降低了研发.生产的成本,使得Android平板品牌如雨后春笋般爆发,山寨机厂商们似乎又找到了一丝希望.与此同时带来的是广大开发者的苦不堪言,各 ...

  8. 尽可能保留原有数据,建立UEFI与BIOS双启PE优盘

    尽可能保留原有数据,建立UEFI与BIOS双启PE优盘1.确保优盘或者移动硬盘有一个FAT32分区,如果没有FAT32分区,就用傲梅分区助手或者ppm转换一个现有的分区到FAT32分区0x0C,或者新 ...

  9. Canvas与Image互相转换

    转换 Image为 Canvas要把图片转换为Canvas(画板,画布),可以使用canvas元素 context 的drawImage方法: // 把image 转换为 canvas对象 funct ...

  10. 使用Markdown+Pandoc+LaTex+Beamer制作幻灯片

    概述 为什么使用markdown? mardown是一种轻量级的标记语言,语法简单,可读性好,并且容易转化成其他格式的文档, 在技术文档撰写中得到越来越广泛的应用.相信大家对markdown都有一定了 ...