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)

相关推荐
我一定会有钱1 小时前
打造完美工作流:Git 配置”一次推送,三端同步”(Gitee/GitCode/GitHub)
开发语言·windows·vscode·搜索引擎·gitlab·github·visual studio code
一技安身1 小时前
【Git】零基础入门实战教程(Windows 完整版,适配竞赛仓库)
windows·git
周末摸鱼2 小时前
一文读懂Git 的底层原理:从 Commit 到 Blob
github
一拳不是超人3 小时前
一个 AI 改出的 bug,另一个 AI 五天就打穿了 Snowflake:Copilot Autofix 事件给 coding agent 的警醒
架构·github
LXY_BUAA4 小时前
Git_在飞牛中部署 GitLab_20260817
git·gitlab
微学AI5 小时前
把 GitHub Issue 的“第一轮脏活”交给 AI:Issue AI Agent 接入蓝耘元生代实战
人工智能·github·issue
阳墨余6 小时前
Git 同时管理 Gitee 和 GitHub 的 SSH 配置实战
git·gitee·github
小弥儿13 小时前
GitHub今日热榜 | 2026-08-16:大模型微调与编码工具扎堆
学习·开源·github
fengyehongWorld14 小时前
Git 认证凭据管理
git
starp18 小时前
skill 管理,后缀为public可以被git commit
github