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

$ 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. react native 学习资料汇总

    http://www.ejiakt.com/album/show/252 http://www.cocoachina.com/ios/20150408/11513.html http://www.os ...

  2. hbm配置文件 generator节点各种解释

    今天犯了个错误 generator节点class属性有这么几个值(主键生成策略方案): assigned:由用户指定主键值 sequence:由oracle序列生成 increment:对类型为lon ...

  3. C语言复杂声明

    C语言复杂声明 First step int *f(); /* f:是一个函数,它返回一个指向int类型的指针*/ int (*pf)(); /* pf:是一个指向函数的指针,该函数返回一个int类型 ...

  4. Windows 数据类型

    类型 定义 描述 ATOM typedef WORD ATOM; 原子(原子表中的一个字符串的参考) BOOL typedef int BOOL; 布尔变量 BOOLEAN typedef BYTE ...

  5. jquery中通过全局变量来禁止多次ajax请求

    var ajaxstate=false;//定义全局变量,通过这个变量来获得当前的ajax状态 $(function(){ $(document).ajaxStart(function(){ $(&q ...

  6. exec函数族实例解析

    exec函数族实例解析 fork()函数通过系统调用创建一个与原来进程(父进程)几乎完全相同的进程(子进程是父进程的副本,它将获得父进程数据空间.堆.栈等资源的副本.注意,子进程持有的是上述存储空间的 ...

  7. zabbix3.0.4 部署之一 (简介)

    官方网站:http://www.zabbix.com/ 下载地址:http://www.zabbix.com/download.php zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视 ...

  8. CENTOS修改主机名

    1.临时修改主机名 显示主机名: zhouhh@zzhh64:~$ hostname zhh64 修改主机名: zhouhh@zzhh64:~$ sudo hostname zzofs zhouhh@ ...

  9. 【安全测试】 WebScarab安装方法

    Webscarab同样需要java环境,下载j2_webscarab-installer.jar包. 1.进入cmd,执行java -jar j2_webscarab-installer.jar命令( ...

  10. 关于OPencv版本不符合,相关库变化问题

    由于OPencv发展迅速,已经省略了很多原来的库文件,奈何自己才疏学浅,所以只能把OPencv 1.0中的相关版本中的库文件一直过去. 链接: http://pan.baidu.com/s/1qY1Z ...