如果涉及到大文件的 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. php常用加密算法

    php加密函数: 不可逆的加密函数为:md5().crypt() md5() 用来计算 MD5 哈稀.语法为:string md5(string str); crypt() 将字符串用 UNIX 的标 ...

  2. NetworkReachable学习笔记

    一.基本知识 在需要联网的iPhone程序中,我们首先需要检查网络的状态,如果不能连接网络则告诉用户程序不能使用的原因是没有网络连接.在iPhone的SystemConfiguration框架里有提供 ...

  3. 关于ADDED_TO_STAGE事件

    可视类初始化的时候,很多时候要用到stage属性,则要使用Event.ADDED_TO_STAGE事件,这个swf被其它的文件加载,如果直接在初始化函数内使用stage属性 .但是,文档类初始化函数内 ...

  4. qpython3 读取安卓lastpass Cookies

    之前我的博客写了python读取windows chrome Cookies,沿着同样的思路,这次本来想尝试读取安卓chrome Cookies, 但是可能是chrome的sqlite3版本比较高读取 ...

  5. js(function(){alert(‘’‘)})

    function(){alert('sss')}是个匿名函数.没有名字.所以没有办法调用.在外面加个括号,就变成了一个值,值的内容是函数的引用.例如var a = (function(){" ...

  6. jq 操作radio,设置选中、获取选中值

    <label><input type="radio" name="sex" value="1">男</labe ...

  7. QT下调用摄像头(opencv2.4.4)

    http://www.cnblogs.com/yuliyang/p/3525107.html 项目pro文件: #------------------------------------------- ...

  8. understanding Nhibernate Hilo

    http://stackoverflow.com/questions/2738671/please-explain-nhibernate-hilo http://stackoverflow.com/q ...

  9. 前端开发环境搭建 Grunt Bower、Requirejs 、 Angular

    现在web开发的趋势是前后端分离.前端采用某些js框架,后端采用某些语言提供restful API,两者以json格式进行数据交互. 如果后端采用node.js,则前后端可以使用同一种语言,共享某些可 ...

  10. MATLAB与C/C++混合编程的一些总结

    [转载请注明出处]http://www.cnblogs.com/mashiqi 先上总结: 由于C/C++语言的函数输入输出参数的特点,可以将多个参数方便地传入一个函数中,但却不能方便地返回多个参数. ...