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)

相关推荐
恋喵大鲤鱼3 分钟前
git remote
git·git remote
朱涛的自习室17 分钟前
Munk AI 正式开源:一个“自我进化”的 AI 测试引擎
android·人工智能·github
恋喵大鲤鱼1 小时前
git cherry-pick
git·git cherry-pick
lpfasd1231 小时前
2026年第23周GitHub趋势周报
github
恋喵大鲤鱼1 小时前
git push
git·git push
Aliaoo2 小时前
GitHub Copilot 改按量计费 72 小时:$28→$746 的账单、暂停新注册,以及这对普通开发者意味着什么
github·copilot
撸码小狂魔2 小时前
GitLab CI/CD 使用指南(小白版)
github
易生一世2 小时前
GitHub Copilot概述
github
stevenzqzq2 小时前
androidstudio 上配置git
git
暴雨课堂2 小时前
宝塔和云效webhook配置
github