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)

相关推荐
Moment2 小时前
MinIO已死,MinIO万岁
前端·后端·github
草梅友仁6 小时前
OpenClaw AI 助手实测与墨梅博客更新 | 2026 年第 10 周草梅周报
开源·github·ai编程
ExcellentWe1 天前
你的AI写的代码总是不理想?这个开源免费的工程流水线编排工具super-dev帮你解决
github
Moment1 天前
腾讯终于对个人开放了,5 分钟在 QQ 里养一只「真能干活」的 AI 😍😍😍
前端·后端·github
小兵张健2 天前
开源 playwright-pool 会话池来了
前端·javascript·github
goodspeed2 天前
Git Worktree:多分支并行开发的利器
git·github
Moment3 天前
Vibe Coding 时代,到底该选什么样的工具来提升效率❓❓❓
前端·后端·github
雮尘3 天前
让 AI Agent 高效并行开发的命令-git worktree
人工智能·git·agent
有道AI情报局4 天前
网易有道龙虾 NAS 服务器部署与实战指南
github