gitHub学习

一、git

1、学习参考:

学习1:http://www.cnblogs.com/wupeiqi/p/7295372.html

学习2(专业):https://www.cnblogs.com/phpper/p/7136048.html

 

 

2、

======================gitHub 远程仓库=======================

 

简易的命令行入门教程:

Git 全局设置:

git config --global user.name "Admin" git config --global user.email "1010155688@qq.com"

创建 git 仓库:

mkdir aaa cd aaa git init touch README.md git add README.md git commit -m "first commit" git remote add origin https://gitee.com/steamfeifei_1010155688/aaa.git git push -u origin master

已有仓库?

cd existing_git_repo git remote add origin https://gitee.com/steamfeifei_1010155688/aaa.git git push -u origin master

 

----gitHub规范

一般小功能久合并一次,review用于查看别人写的代码

 

fork用于下载被人的代码道本地,修改后,可以使用pull request 返回给原作者,然后看看原作者是否采用

 

 

注意:不要把公司的代码都放到gitHub上

============================================================

三、报错解决:

1、(转)Updates were rejected because the tip of your current branch is behind

https://www.cnblogs.com/code-changeworld/p/4779145.html

刚创建的github版本库,在push代码时出错:

$ git push -u origin master

To git@github.com:******/Demo.git

 ! [rejected] master -> master (non-fast-forward)

error: failed to push some refs to 'git@github.com:******/Demo.git'

hint: Updates were rejected because the tip of your current branch is behind

hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')

hint: before pushing again.

hint: See the 'Note about fast-forwards' in 'git push --help' for details.

网上搜索了下,是因为远程repository和我本地的repository冲突导致的,而我在创建版本库后,在github的版本库页面点击了创建README.md文件的按钮创建了说明文档,但是却没有pull到本地。这样就产生了版本冲突的问题。

有如下几种解决方法:

1.使用强制push的方法:

$ git push -u origin master -f 

这样会使远程修改丢失,一般是不可取的,尤其是多人协作开发的时候。

2.push前先将远程repository修改pull下来

$ git pull origin master

$ git push -u origin master

3.若不想merge远程和本地修改,可以先创建新的分支:

$ git branch [name]

然后push

$ git push -u origin [name]

 

2、

git pull 报错:git - error: RPC failed; curl 18 transfer closed with outstanding read data remaining 解决

在git pull公司项目的时候,发现报错了。报错信息如下所示:

报错信息: 
fatal: The remote end hung up unexpectedly 
error: RPC failed; curl 18 transfer closed with outstanding read data remaining 
fatal: The remote end hung up unexpectedly 
fatal: early EOF 
fatal: index-pack failed

错误原因:由于Http协议错误,当Pull或者Clone的时候 
因为curl的postBuffer默认值太小的原因,而项目可能本身比较大,所以下载失败。

解决方案: 在Git Bash Here 中执行: 
1、Git config –global http.postBuffer 524288000 
解析:相当于把curl的postBuffer的值修改的大一些。524288000的单位是B,相当于500MB。

2、git config –list 
解析:查看配置,看看新配置是否生效。

3、然后继续执行git pull等命令即可。

注意:如果修改之后还是报相同的错误。那么不用怀疑,可能时候你的项目实在太大了。。。继续加大postBuffer的数值吧,小伙。

参考链接:http://blog.csdn.net/snails_zx/article/details/54587132

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值