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)

相关推荐
峰向AI9 小时前
Kage: 一个 244KB 文件,做出百万级视觉效果
github
Hvitur10 小时前
Linux安装Git【离线安装】
git
m4Rk_12 小时前
【论文阅读】Agent 记忆机制(74):CompassMem——从相似度检索走向事件图上的记忆导航
论文阅读·人工智能·学习·开源·github
wflynn13 小时前
GitHub 日榜趋势速报 | 2026-09-18
开源·github
howard200515 小时前
6.4 Git安装与配置
git·安装配置
粥里有勺糖16 小时前
视野修炼第133期 | Native 回春了?
前端·github·agent
tryCbest19 小时前
git实现前后端分离项目提交同一个仓库
git·gitee
Mr.朱鹏19 小时前
Git 仓库同时推送到 Gitee 与 GitHub 配置指南
git·gitee·开源·github
All for pursuit.21 小时前
FastAPI+Ollama 部署本地AI大模型对话助手
python·github·aigc·ollama
u1301301 天前
GitHub 热榜项目:日榜(2026-09-18)
人工智能·github