Github 下载指定文件夹(git sparse-checkout)

比如要下载这里的 data_utils

步骤

1、新建空文件夹,并进入新建的空文件夹。

2、git init 初始化

3、git remote add origin 添加远程仓库

4、git config core.sparsecheckout true 允许稀疏检出

5、git sparse-checkout set 设置需要拉取的文件夹(可以同时拉取多个,中间加空格即可)

6、git pull origin main 拉取

添加

在已经进行过稀疏检出的文件夹中,添加其它文件夹。

使用git sparse-checkout add。

结果:

ps:git sparse-checkout 和 git lfs 不兼容

参考资料:

https://www.git-scm.com/docs/git-sparse-checkout(官方文档)

https://blog.csdn.net/shelutai/article/details/123116973

https://zhuanlan.zhihu.com/p/57390306

https://cloud.tencent.com/developer/article/2008489

https://github.com/git-lfs/git-lfs/issues/3803(git lfs issue)

相关推荐
wflynn18 分钟前
GitHub 日榜趋势速报 | 2026-10-03
开源·github
本地化文档36 分钟前
pygmt-docs-l10n
python·github·gitcode·sphinx·pygmt·gmt·crowdin
喵本喵叁肆41 分钟前
Git 深度解读:从对象模型到分支指针,把版本控制的内核讲透
git
wflynn1 小时前
GitHub 今日推荐|REDox:64 位 token 表示结构化数据,内存占用降 70% 支持多格式互转
开源·c#·github
miofly1 小时前
GitHub 周榜趋势速报 | 2026-10-04
开源·github
miofly1 小时前
GitHub 日榜趋势速报 | 2026-10-04
开源·github
怕浪猫12 小时前
Prompt Engineering 面试怎么考?这 5 个范式你必须会
面试·程序员·github
可乐ea16 小时前
GitHub Security Lab 开源 Fuzzing Taskflow:让 LLM 智能体自己跑完 C/C++ 模糊测试
jvm·c++·github·模糊测试·mcp·代码agent·智能体自动化
TOOLS指南17 小时前
GitHub 和 ai.github 是什么?两者有什么区别
人工智能·github
贾斯汀frank17 小时前
Fleurdelix OS已预装办公套件ONLYOFFICE桌面编辑器
github