如果涉及到大文件的 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. Linux diable ipv6

    在RHEL 5下面测试成功     linux下面禁止ipv6的方法: 来自: 杨志刚 博客 (http://yangzhigang.cublog.cn)   这里我所做的是Redhat Linux, ...

  2. web项目的日志打印位置设置

    1, 若在项目中放logback.groovy文件(如: src/test/resource下),则日志会打印到控制台上. logback.groovy 内容如下: // // Built on Fr ...

  3. sqlserver中创建包含事务的存储过程

    什么是事务     事务时包含1条或多条语句的逻辑单元.事务中的语句是一个整体,要么一起提交,要么一起撤销.事务在提交前可以回滚,一旦提交就不能撤销修改了,是永久性的修改.   为什么使用事务     ...

  4. Rhel6-vpn配置文档

    系统环境: rhel6 x86_64 iptables and selinux disabled 主机: 192.168.122.160 server60.example.com 192.168.12 ...

  5. Galaxy Classification

    10.3 Data Preparation After removing a large number of the columns from the raw SDSS dataset, introd ...

  6. JS中数据类型及原生对象简介

    js是一种专门设计用来给网页增加交互性的编程语言,它的技术体系包含了一下几个方面: 1.JavaScript核心语言定义:包括数据类型,变量,常量,运算符,语句等. 2.原生对象和内置对象 3.浏览器 ...

  7. Linq一 基础知识

    1.什么是Linq 他是VS2008(.net framework 3.5)之后一项重大的突破 全程Lnaguage Integrated Query,可以成为数据迭代器. 主要有以下5大块组成: L ...

  8. 判断CAD版本

    使用命令: ACADVER ACADVER = "17.2s (LMS Tech)" (只读) CAD2016 ACADVER = "20.1s (LMS Tech)&q ...

  9. Unity Sprite切割导出

    这次需要将美术提供的Sprite图集切割导出,整体思路依然和上次的Sprite转prefab一致,只是在转prefab的逻辑修改为了创建Texture的逻辑. 过程很简单,直接看最终代码结果: usi ...

  10. Spark 个人实战系列(1)--Spark 集群安装

    前言: CDH4不带yarn和spark, 因此需要自己搭建spark集群. 这边简单描述spark集群的安装过程, 并讲述spark的standalone模式, 以及对相关的脚本进行简单的分析. s ...