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)

相关推荐
Moonbit8 小时前
月报 Vol.04 : 新增 async test 与 async fn main 语法,新增 lexmatch 表达式
后端·github·编程语言
逛逛GitHub8 小时前
发现 4 个贼好玩的 GitHub 项目,相当给劲儿。
github
悟能不能悟10 小时前
用cmd命令修改适配器ip
网络·tcp/ip·github
刘志辉10 小时前
git指令
git
whysqwhw10 小时前
kuiklyui core-ksp ios
github
whysqwhw10 小时前
kuiklyui core-ksp 鸿蒙
github
CoderJia程序员甲11 小时前
GitHub 热榜项目 - 日榜(2025-10-12)
ai·github·开源项目·github热榜
whysqwhw11 小时前
kuikly core-ksp 安卓
github
Tfly__12 小时前
Ubuntu 20.04 安装Aerial Gym Simulator - 基于 Gym 的无人机强化学习仿真器
linux·人工智能·ubuntu·github·无人机·强化学习·运动规划
2501_9167665413 小时前
【Git学习】初识git:简单介绍及安装流程
git·学习