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

$ 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. Cheatsheet: 2015 07.01 ~ 07.31

    Java JBoss Drools Tutorial for Beginners Other A Simple File System RebornDB: the Next Generation Di ...

  2. jquery总结02-样式和属性

    .attr()  .removeAttr() 设置属性和移除属性,里面可以是属性,属性值 ,只有属性名时只获取第一个蒜素的属性值 .html() .text() .val()  html 获取包括标签 ...

  3. 《BI项目笔记》创建时间维度(1)

    SSAS Date 维度基本上在所有的 Cube 设计过程中都存在,很难见到没有时间维度的 OLAP 数据库.但是根据不同的项目需求, Date 维度的设计可能不大相同,所以在设计时间维度的时候需要搞 ...

  4. 从零开始HTML(一 2016/9/19)

    就是准备跟着W3C上的教程过一遍HTML啦,边看边记录更便于理解记忆吧~ 1.属性 HTML 标签可以拥有属性.属性提供了有关 HTML 元素的更多的信息.属性总是以名称/值对的形式出现,比如:nam ...

  5. [Mysql] mysql临时表corrupt

    问题描述 机房临时硬件问题, 机器掉电. 恢复后, 重启mysql进程, 结果出现core dump. 而且一直循环, 无法终止, 只能kill掉. backtrace如下. # service my ...

  6. 线程池ExecutorService和完成服务CompletionService的使用获取线程的返回结果

    package com.suning.ecif.admin.app.impl.temp; import java.util.ArrayList;import java.util.Collection; ...

  7. contiki-main.c 文件的进程分析

    基本进程的创建实例: 共三部分:创建进程.进程自启动和进程的主体部分 /* 声明一个名为hello_world_process和led_process进程 PROCESS 宏实际上声明一个函数并定义一 ...

  8. Gson手动序列化POJO(工具类)

    gson2.7版本 只是简单的工具类(练习所用): package pojo; import javax.xml.bind.annotation.XmlSeeAlso; import com.goog ...

  9. python 中分支结构(switch)

    可通过字典调用:{1:case1,2:case2}.get(x,lambda *args,**key:)() # 编写一个计算器 # -*- coding=utf-8 -*- def jia(x,y) ...

  10. 20169212《Linux内核原理与分析》第二周作业

    <Linux内核原理与分析>第二周作业 这一周学习了MOOCLinux内核分析的第一讲,计算机是如何工作的?由于本科对相关知识的不熟悉,所以感觉有的知识理解起来了有一定的难度,不过多查查资 ...