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)

相关推荐
lpfasd12321 分钟前
2026年第44周GitHub趋势周报
github
qq_4109603523 分钟前
GitHub Actions 为何适合定时任务调度?底层机
github
miofly34 分钟前
MIT 团队用 GPT-6 Astra 改写小模型权重,跳过梯度训练提升指令遵循能力
开源·github
逛逛GitHub1 小时前
盘点 10 月份 19 个 Star 大涨的 GitHub 项目,第一个很有用。
github
克里斯蒂亚诺更新1 小时前
git引入其他分支并且合并
git
java_nnnn1 小时前
Spring Boot 配置文件详解:从基础语法到 YAML 配置
spring boot·后端·github
全栈陈序员1 小时前
【Git】从入门到精通(二)—— Git安装与初次配置
数据仓库·git
miofly2 小时前
GitHub 今日推荐|agent-desktop:通过无障碍树让 AI 代理直接操作桌面应用
rust·开源·github
XLYcmy2 小时前
实验报告分析评价文档——《第四次阶段汇报:模型产物的仓库瘦身、云端部署与评测链路打通》评析
git·llm·cpu·gpu·反编译·反汇编·safetensors
全栈陈序员2 小时前
【Git】从入门到精通(三)—— 创建第一个Git仓库
大数据·git·elasticsearch