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)

相关推荐
九成宫1 小时前
Git 与远程仓库实操记录:克隆、配置、分支推送与问题排查
笔记·git·ssh
jinanwuhuaguo2 小时前
(第三十三篇)五月的文明奠基:OpenClaw 2026.5.2版本的文明级解读
android·java·开发语言·人工智能·github·拓扑学·openclaw
DogDaoDao2 小时前
【GitHub】andrej-karpathy-skills:让 AI 编程助手告别三大通病
人工智能·深度学习·程序员·大模型·github·ai编程·andrej-karpathy
Shin_chan5 小时前
Linux 内核史诗级提权漏洞:CVE-2026-31431 复现与分析
github
CoderJia程序员甲7 小时前
GitHub 热榜项目 - 日榜(2026-05-03)
ai·大模型·llm·github·ai教程
yyuuuzz8 小时前
aws 基础认知与实践注意点
运维·服务器·网络·云计算·github·aws
weixin_514253189 小时前
430-github-aguvis tmux
github
阿里嘎多学长10 小时前
2026-05-03 GitHub 热点项目精选
开发语言·程序员·github·代码托管
努力努力再努力wz10 小时前
【MySQL进阶系列】一文打通事务机制:从锁、Undo Log 到 MVCC 与隔离级别
c语言·数据结构·数据库·c++·mysql·算法·github
武超杰10 小时前
Git 从入门到精通教程
git