如何在mac和linux上批量下载所有git LFS文件?

时间:2017-01-17 18:36:00

标签: git git-clone git-lfs

当我在Windows中运行git lfs clone somerepository时,我得到了以下输出

Cloning into 'somerepository'...
remote: Counting objects: 24028, done.
remote: Compressing objects: 100% (5003/5003), done.
remote: Total 24028 (delta 7376), reused 23762 (delta 7265)
Receiving objects: 100% (24028/24028), 7.12 MiB | 3.86 MiB/s, done.
Resolving deltas: 100% (7376/7376), done.
Git LFS: (57 of 57 files) 1.57 GB / 1.57 GB

最后一行意味着git在几个批次中下载了al文件(当时不是git pull的1个文件)并且它非常快。

在linux和mac中,相同的命令只执行前6个步骤,也不执行最后一个步骤,只将所有LFS跟踪的文件作为指针。如果我进行fetch / checkout / pull,git会在当时下载一个文件并且非常慢。我比较了不同Linux / Windows / Mac系统中的所有配置,并且最新版本的git和git-lfs的行为都是一样的。

我想知道git lfs clone运行的最后一个命令是什么,以及如何在Linux和Mac上手动或自动触发它。

由于

1 个答案:

答案 0 :(得分:0)

它在Gerrit服务器上按预期工作:

> git lfs clone https://USER@GERRIT-SERVER/a/REPOSITORY
Cloning into 'REPOSITORY'...
remote: Counting objects: 5, done
remote: Finding sources: 100% (5/5)
remote: Total 929 (delta 0), reused 929 (delta 0)
Receiving objects: 100% (929/929), 151.10 KiB | 0 bytes/s, done.
Resolving deltas: 100% (275/275), done.
Checking connectivity... done.
Git LFS: (2 of 2 files) 1.77 MB / 1.77 MB

> git --version
git version 2.7.4

> git lfs version
git-lfs/1.5.3 (GitHub; linux amd64; go 1.7.4; git 23455e48)

$ HOME / .gitconfig LFS内容:

[filter "lfs"]
    clean = git-lfs clean -- %f
    smudge = git-lfs smudge -- %f
    process = git-lfs filter-process
    required = true