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)

相关推荐
zhensherlock14 小时前
Protocol Launcher 系列:CodeHub 移动端 GitHub 协作利器
前端·javascript·typescript·node.js·自动化·github·js
一条Go17 小时前
状态页与 SLA:对外承诺是怎么算出来的
后端·架构·github
一条Go17 小时前
开源新生代雷达 · 第 18 期
github
时早玖沐18 小时前
微信输入法的算式结果时灵时不灵,我用 AutoHotkey 补了个按 = 出答案的
程序员·开源·github
武昌库里写JAVA1 天前
SpringBoot+Vue 项目介绍
java·javascript·git·sql·ai
杨凯凡2 天前
IT日报|2026-11-20:欧盟 AI 网络攻击、Valkey 9.2、GitHub 企业迁移
人工智能·github
TunerT_TQ2 天前
Terraform OCI Provider 2026:工具链的骨架清晰可见,CRUD 的肌肉必须由你亲自验证
github
prince_zxill2 天前
把 17 个散文件装进一个文件夹:拆解 claude-plugins-official 的插件打包术(47,413 Star 实测)
python·github·agent·mcp·claude code
wflynn2 天前
GitHub 日榜趋势速报 | 2026-11-20
开源·github
TunerT_TQ2 天前
【开源评测】google-labs-code/stitch-skills:从设计交接到可检查的组件产物
github