git lfs 从远程 GitHub 存储库克隆的更快替代方案?

Faster alternative to git lfs clone from remote GitHub repositories?

Objective

我有一个遥控器 GitHub repositories,它使用 git-lfs 来保存大型二进制文件。

基线方法(git lfs clone

为了测试其他人如何下载我的存储库,我 运行 在 Linux 集群上的高性能登录节点(具有 72 个 Intel Xeon CPU)上使用 gpfs​​ 运行 以下命令磁盘,以及这些版本的 git 和 git-lfs.

$ time git lfs clone --progress git@github.com:PackardChan/chk2019-blocking-extreme.git
Cloning into 'chk2019-blocking-extreme'...
remote: Enumerating objects: 138, done.
remote: Counting objects: 100% (138/138), done.
remote: Compressing objects: 100% (114/114), done.
remote: Total 138 (delta 20), reused 138 (delta 20), pack-reused 0
Receiving objects: 100% (138/138), 148.16 MiB | 36.59 MiB/s, done.
Resolving deltas: 100% (20/20), done.
Git LFS: (64 of 64 files) 7.29 GB / 7.29 GB                                                              

real    4m51.156s
user    7m14.044s
sys 0m28.360s

即使在高性能节点中,这也需要将近 5 分钟。我注意到最后一行输出只用了 36 秒就达到了 7.29GB。剩下的时间就是运行git update-index -q --refresh --stdin(我从top -c命令中学到的)

因此,我相信如果可以跳过 update-index,性能可以得到显着提高。 "Objectives"中提到,如果可以提高速度,我不介意放弃git版本控制。

其他不成功的尝试

  1. svn 导出

受到这个post的启发,我尝试了:

time svn export https://github.com/PackardChan/chk2019-blocking-extreme/trunk z4svn

但是 lfs 文件没有正确下载。这也被报道here.

  1. git存档

然而,GitHub doesn't support git-archive.

  1. --深度=1

我试过了,效果并不好。这是可以理解的,因为我的存储库只有一个提交。

我对 git 比较陌生。那么,我错过了什么吗?

我正在回答我自己的问题。原来问题是我没有 运行 git lfs install 设置 ~/.gitconfig.

git lfs install [options]

Perform the following actions to ensure that Git LFS is setup properly:

  • Set up the clean and smudge filters under the name "lfs" in the global Git config.
  • Install a pre-push hook to run git lfs pre-push for the current repository, if run from inside one. If "core.hooksPath" is configured in any Git configuration (and supported, i.e., the installed Git version is at least 2.9.0), then the pre-push hook will be installed to that directory instead.

在那之后,我还有 4 行来自 git config --list 的配置报告。

filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true

现在 time git lfs clone --progress git@github.com:PackardChan/chk2019-blocking-extreme.git 的相同命令只需要大约 1 分钟。