克隆clone github上某个项目的子目录

有时会遇到只需要克隆github某个项目的子目录,此时可以使用以下方法实现:

需求示例:

现需要克隆:https://github.com/SingleZombie/DL-Demos项目中的ddim项目

注:ddim项目的地址为:https://github.com/SingleZombie/DL-Demos/tree/master/dldemos/ddim

Step1: git clone --filter=blob:none --no-checkout https://github.com/SingleZombie/DL-Demos
Step2: cd DL-Demos, 即表示进行到该目录
Step3: git sparse-checkout init --cone
Step4: git sparse-checkout set dldemos/ddim, 其中dldemos/ddim表示https://github.com/SingleZombie/DL-Demos这个目录下的相对路径
Step5: git checkout master, 其中master表示分支,可以在github项目中查看,如下图所示:

详细的代码步骤如下:

复制代码
git clone --filter=blob:none --no-checkout https://github.com/SingleZombie/DL-Demos
cd DL-Demos
git sparse-checkout init --cone
git sparse-checkout set dldemos/ddim
git checkout master
相关推荐
qetfw1 小时前
CentOS 7 搭建 LDAP 目录服务
linux·运维·centos
BerrySen1781 小时前
我的AI辅助开发工具链2026版
开源·github
ALINX技术博客2 小时前
【黑金云课堂】FPGA技术教程Linux开发:系统进阶-PS DMA
linux·fpga开发
dong_junshuai2 小时前
每天一个开源项目#40 Apache Ossie:1K Stars的AI/BI语义层通用标准
github
Lary_Rock2 小时前
MTK SecureBoot全链路配置指南
前端·vscode·github
IT方大同2 小时前
linux简介
linux·运维·服务器
mounter6253 小时前
从内存隔离到运行时防线:透视 Linux 内核安全强化的博弈与演进
linux·网络·安全·linux kernel·kernel
逛逛GitHub4 小时前
终于有一个蒸馏 Apple 风格的 Skill 了,GitHub 上有 10.5K 人点赞。
github
微道道4 小时前
Linux盒子局域网内使用 .local 域名访问,告别IP变化烦恼
linux·运维·服务器·hermes
Bug退散师5 小时前
多路IO复用[select版TCP服务器与poll版TCP服务器]与常用网络编程函数详解
linux·服务器·c语言·网络·驱动开发·tcp/ip