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)

相关推荐
redreamSo2 小时前
一天涨 1800 星的 GitHub 榜首:AI 编程瓶颈变成了 token
人工智能·开源·github
逛逛GitHub4 小时前
盘点 18 个 Kimi K3 外网爆火的案例,太令人惊艳了。
github
CodexDave6 小时前
数据库连接池耗尽:排查顺序与三层兜底
服务器·前端·数据库·git·云原生·容器·kubernetes
乐观的Terry7 小时前
5、发布系统-Git 集成
大数据·git·elasticsearch
benchmark_cc8 小时前
如何用 Python 进行多周期 K 线合成与时区对齐?基于 QuantDash 与 Pandas 的量化数据清洗实战(附 GitHub 源码)
开发语言·python·github·盯盘·pandas·quantdash·量化数据
luyingying8 小时前
从 400 行到 30 个文件,我只做了一件事
github
武子康8 小时前
GitHub Actions `pull_request_target` 与 Pwn Request:高权限工作流里的 Fork 代码执行风险(2026)
人工智能·github·ai编程
不怕犯错,就怕不做8 小时前
GIT的简单打patch应用format-patch and git am
linux·git·全文检索
Byron Loong8 小时前
【Git】如何检查 Ubuntu 系统上 gitLab 是否开启
git·ubuntu·gitlab
武子康9 小时前
GitHub Models 7-30 退役全拆:Inventory + Capability Probe + Shadow Traffic + Brownout
人工智能·github·github copilot