在克隆vant的源码时报错:

remote: Enumerating objects: 9817, done.
error: RPC failed; curl 56 GnuTLS recv error (-9): A TLS packet with unexpected length was received.
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

解决办法:

$ sudo apt-get purge git
$ sudo apt-get install git

问题解决。更新,以上似乎不能根治,下次还会出现。

实际上,由于git默认缓存大小不足导致的
解决方法是:使用下面的命令增加缓存大小。

apt-get install gnutls-bin
git config --global http.sslVerify false
git config --global http.postBuffer 1048576000  #1G;524288000:大约500M
git config --list 查看设置值

另外三种方法:

  1. 增加缓存区大小
    git config --global http.postBuffer 524288000

    ps:push时遇到报错,也可以用这种方法。这个数值大约是500M(具体怎么计算的找了好久没有相关信息,希望有知道的大佬告知下,万分感谢)。

  2. 减小要clone的项目大小
    git clone https://github.com/youzan/van... --depth 1

    ps: 这里解释一下,--depth 1,的意思是只clone默认分支的最新一次提交。有童鞋要是想clone所有的分支,网上也有解决办法,可自行搜索。这个不在本次要说的范围内。

  3. 换协议
    例如:将 git clone https://github.com/youzan/van...,
    改为 git clone git://github.com/youzan/vant.git