如何 clone/pull 一个 git 存储库,忽略 LFS?

How to clone/pull a git repository, ignoring LFS?

有没有办法明确忽略 clonepull 上的所有 git-lfs 文件?
(除了卸载 git-lfs 我结束了正在做)。


在这种情况下 git-lfs 只包含我不使用的平台的预编译库...所以获取它们绝对没有用。

两种选择:

(1) 使用 GIT_LFS_SKIP_SMUDGE 变量:

GIT_LFS_SKIP_SMUDGE=1 git clone SERVER-REPOSITORY

Obs:对于“Windows”,使用以下两个命令:

set GIT_LFS_SKIP_SMUDGE=1  
git clone SERVER-REPOSITORY

(2) 配置git-lfs涂抹:

git config --global filter.lfs.smudge "git-lfs smudge --skip -- %f"
git config --global filter.lfs.process "git-lfs filter-process --skip"
    
git clone SERVER-REPOSITORY

要撤消此配置,请执行:

git config --global filter.lfs.smudge "git-lfs smudge -- %f"
git config --global filter.lfs.process "git-lfs filter-process"

我目前正在努力寻找一种干净的方法来使用 git-lfs 下载(然后删除)大文件。

然而,@Marcelo Ávila de Oliveira 的 post 还有第三种选择:

git lfs install --skip-smudge

将全局定义为在克隆存储库时最初跳过 lfs 下载。


编辑: 我已经为基本 git-lfs 处理创建了一个教程。非常欢迎任何反馈和建议。

您可以在以下位置找到它:

https://sabicalija.github.io/git-lfs-intro/

或通过以下方式拉取:

git clone https://github.com/sabicalija/git-lfs-intro.git