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)

相关推荐
chaors1 小时前
DeepResearchSystem 0x03:HITL
llm·github·ai编程
OpenTiny社区1 小时前
Loop Engineering:让 AI Agent 自己跑起来的工程方法
前端·github
木心术12 小时前
GitHub Actions自动化运维实战:从CI/CD到全链路DevOps
运维·自动化·github
炸膛坦客3 小时前
Git 和 GitHub:(七)将本地新建仓库与 GitHub 远程仓库关联起来(SSH)
git·ssh·github
fthux3 小时前
GitZip Pro:给GitHub仓库“瘦身”的魔法剪刀手
人工智能·chrome·ai·语言模型·开源·github·open source
u1301304 小时前
GitHub 热榜项目:周榜(2026-07-26)
github
逛逛GitHub4 小时前
这个开源的 Skills 让 Codex 帮你女朋友管理穿搭,太有意思了~
github
晨汐丶4 小时前
GitHub 上全是 Agent 项目,但你怎么知道哪个真的靠谱?我写了一个分析器
github
流量猎手6 小时前
GitHub 使用说明
大数据·elasticsearch·github
炸膛坦客10 小时前
Git 和 GitHub:(六)在本地新建仓库并进行一次提交
git·github