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)

相关推荐
后台模板学习2 小时前
GitHub Actions 与 Jenkins 在日志监
运维·github·jenkins
miofly2 小时前
GitHub 今日推荐|auto-ontology:给 Agent 装上企业数据的语义索引
python·开源·github
无言听风雨丶3 小时前
Kubernetes GitOps 持续交付实战:用 Argo CD 让 Git 成为集群事实源
git·elasticsearch·kubernetes
全栈陈序员4 小时前
【Git】从入门到精通(六)—— git commit:提交到版本库
大数据·git·elasticsearch
miofly4 小时前
GitHub 日榜趋势速报 | 2026-11-04
开源·github
钱栈up12 小时前
GitHub 热榜上手|Orca:让多个编码 Agent 并排跑
github
wflynn17 小时前
GitHub 日榜趋势速报 | 2026-11-02
开源·github
徐小夕18 小时前
深度剖析 30k star 的编码 Agent DeepSeek-Reasonix:长会话 Token 成本直降 80%
前端·vue.js·github
Iron_18 小时前
多平台内容分发的适配器
github