如果涉及到大文件的 git 传输, 我们可能会收到下面错误:

sourceTree 的错误。

 

命令行的错误:

 

$ git clone https://********/gopher.git
Cloning into 'gopher'...
remote: Counting objects: 275, done.
remote: Compressing objects: 100% (234/234), done.
fatal: The remote end hung up unexpectedlyB | 87.00 KiB/s    
fatal: early EOF
fatal: index-pack failed

网上提到的解决方案有下面几个:

修改 git 的默认 postBuffer 的大小

如果 是需要 post 的文件比较大, 则可通过修改 git 的默认 postBuffer 的大小

linux

$ git config http.postBuffer 524288000

全局的设置则可以是:

$ git config --global http.postBuffer 524288000

windows:
在 .git/config 文件中加入
[http]
postBuffer = 524288000

http://blog.sina.com.cn/s/blog_71d4414d0100wfwq.html 

 

分步下载

 

First, turn off compression:

$ git config --global core.compression 0
Next, let's do a partial clone to truncate the amount of info coming down:

$ git clone --depth 1 <repo_URI>
When that works, go into the new directory and retrieve the rest of the clone:

$ git fetch --unshallow
or, alternately,

$ git fetch --depth=2147483647
Now, do a regular pull:

$ git pull --all
I think there is a glitch with msysgit in the 1.8.x versions that exacerbates these symptoms, so another option is to try with an earlier version of git (<= 1.8.3, I think).

当然 git clone 可以变成下面几步:

$ git init
Initialized empty Git repository in /Users/ghj1976/Documents/work/wangpos/git/gopher/.git/

$ git remote add origin https://******/gopher.git

$ git pull --depth 1
remote: Counting objects: 141, done.
remote: Compressing objects: 100% (114/114), done.
remote: Total 141 (delta 4), reused 0 (delta 0)
Receiving objects: 100% (141/141), 1.68 MiB | 45.00 KiB/s, done.
Resolving deltas: 100% (4/4), done.
From https://******/gopher
* [new branch]      master     -> origin/master
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> master

 

这里面的 关键 就是用 –depth 获得最近几次的更新记录。 这个数字可以是任意的int数字。

git clone YOUR_REPO --depth=1
git fetch --depth=10
...
git fetch --depth=100
git fetch --unshallow //Downloads all history allowing to push from repo

--depth <depth>

Create a shallow clone with a history truncated to the specified number of revisions. A shallow repository has a number of limitations (you cannot clone or fetch from it, nor push from nor into it), but is adequate if you are only interested in the recent history of a large project with a long history, and would want to send in fixes as patches.

参考资料:

http://stackoverflow.com/questions/21277806/fatal-early-eof-fatal-index-pack-failed

http://stackoverflow.com/questions/4826639/repack-of-git-repository-fails

git 分批后的数据的更多相关文章

  1. git database 数据库 平面文件 Git 同其他系统的重要区别 Git 只关心文件数据的整体是否发生变化,而大多数其他系统则只关心文件内容的具体差异 Git 的设计哲学

    小结: 1.如果要浏览项目的历史更新摘要,Git 不用跑到外面的服务器上去取数据回来 2.注意 git clone  应指定版本,它复制的这个版本的全部历史信息: 各个分支  git init 数据库 ...

  2. PDA手持扫描资产标签,盘点完成后将数据上传到PC端,固定资产系统查看盘点结果

    固定资产管理系统介绍: 致力于研发条码技术.集成条码系统的专业性公司,针对客户的不同需求,提供一站式的企业条码系统解决方案:包括功能强大的软件系统.安全可靠的无线网络.坚固耐用的硬件系统.灵活易用的管 ...

  3. 如何用perl将表格中不同列的数据进行拼凑,然后将拼凑后的数据用“|”连接在一起

    最近写了一个perl脚本,实现的功能是将表格中其中两列的数据进行拼凑,然后将拼凑后的数据用“|”连接在一起. 表格内容如下: 员工号码 员工姓名 职位 入职日期 1001 张三 销售 1980/12/ ...

  4. SqlServer触发器判断对表操作类型(增、删、改)并将修改后的数据映射到新表

    该文章为原创,日后可能会根据实际开发经验和网友评论,进行相应地方修改,为获得最新博客动态,望在转发博客的时候注明出处. 触发器要实现的功能: (1)获取对表Table1数据操作操作类型(insert. ...

  5. input中空格后的数据不显示

    bug,input中空格后的数据不显示     昨天在修bug,有一个bug是用户修改的个人信息的地址栏,输入有空格的话,空格后面的内容存不上,而且没有报错,奇怪了,只好跟踪下. 页面上的输入框就是个 ...

  6. GDAL 遥感图像处理后的数据保存为图像文件的实现方法

    在遥感图像处理中,GDAL库不仅能读取和处理大部分的遥感图像数据,而且还能够实现图像处理后将数据保存为图像的功能. 本文就详细介绍如何将内存中的图像数据保存为.tif格式. 首先,遥感数据处理完,保存 ...

  7. opencv face-detection 代码分析 (1)人脸识别后的数据

    2014,3,16   老师的工作建议如下:   1. 与四民沟通下,把openCV这边的源代码和调用接口发给四民同时抄送给我. 2. 根据openCV的实时检测结果,实现对屏幕的调整(下周一前基本实 ...

  8. SSL/TLS/WTLS原理(密钥协商的形象化比喻:验证服务器的身份,用服务器的公钥协商加密格式,然后再加密具体的消息,TCP传递SSL处理后的数据)good

    一 前言 首先要澄清一下名字的混淆: 1 SSL(Secure Socket Layer)是netscape公司设计的主要用于web的安全传输协议.这种协议在WEB上获得了广泛的应用. 2 IETF( ...

  9. 转:SqlServer2008误操作数据(delete或者update)后恢复数据

    Sqlserver2008误操作数据(delete或者update)后恢复数据(转) 实际工作中,有时会直接在数据库中操作数据,比如对数据进行delete或者update操作,当进行这些操作的时候,如 ...

随机推荐

  1. iOS开发UI篇—Quartz2D简单介绍

    iOS开发UI篇—Quartz2D简单介绍 一.什么是Quartz2D Quartz 2D是⼀个二维绘图引擎,同时支持iOS和Mac系统 Quartz 2D能完成的工作: 绘制图形 : 线条\三角形\ ...

  2. bzoj 3170: [Tjoi 2013]松鼠聚会

    #include<cstdio> #include<iostream> #include<algorithm> #define M 100008 using nam ...

  3. HTML新增属性

    1.<input type="text" required必填  placeholder="默认显示内容"  autofocus自动获取焦点 /> ...

  4. Linux I2C总线控制器驱动(S3C2440)

    s3c2440的i2c控制器驱动(精简DIY),直接上代码,注释很详细: #include <linux/kernel.h> #include <linux/module.h> ...

  5. 将excel2003文档文件转换为excel2007格式

    在sharepoint 2010 中,excel2007或excel 2010文档格式,支持web app 应用,能够在浏览器在线打开,查看,但excel 2003格式的文档只能用office客户端打 ...

  6. 初学JavaScript七大注意事项

    知识说明: 初学JavaScript,注意以下七大细节,在实现同样功能的情况下,让我们的代码更易懂.效率更高. 一.简化代码 例如:创建对象 之前是这样的: Var car = new object( ...

  7. Spring使用——切面编程AOP使用

    在我们的spring xml配置中,加上<aop:config>之后,Eclipse报错,提示The prefix "aop" for element "ao ...

  8. css+div

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...

  9. UDP信息接收与发送

    转载:http://www.cnblogs.com/sunev/archive/2012/08/08/2627247.html 一.摘要 总结基于C#的UDP协议的同步通信. 二.实验平台 Visua ...

  10. iOSapp的json告示

    看到这篇文章,要知道这篇文章告诉你什么,就是对json的解析的一个解释,解析的代码去百度就可以了,OC的.安卓的.JS的等等都很多,但是对于swift语言的小白来说,资料就少之又少,包括一些看不懂的, ...