克隆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
相关推荐
Lsetea9 分钟前
curl访问HTTPS返回304却没有正文:条件请求、缓存与证书验收排查
linux·http·https·ssl证书·curl
NEAI_N25 分钟前
嵌入式Linux调试:microcom 串口工具
linux
叼烟扛炮35 分钟前
Linux 学习笔记(九):自动化构建神器 Make 与 Makefile
linux·运维·服务器
lisanmengmeng39 分钟前
监控Kubernetes集群的GPU资源(三)
linux·容器·kubernetes
蜡笔羊驼42 分钟前
ModuleNotFoundError: No module named ‘torchvision.transforms.functional_tensor‘
linux·人工智能·python
箓维44 分钟前
线程池&&线程安全与可重入
linux·网络·安全
程序员-Benothing1 小时前
Linux端口与连接排查:ss、lsof、nc、telnet、curl
linux·运维·服务器
邪修king1 小时前
Re:Linux系统篇(三十七):进程间通信Chapter4:System V 共享内存深度解析:为什么它是最快的 IPC?
android·linux·运维
m4Rk_1 小时前
【论文阅读】Agent记忆机制(106):COUNTERMEM——用可执行世界模型验证“如果当时换个动作”的反事实记忆
论文阅读·人工智能·学习·开源·github
十方空烬1 小时前
开源雷达 · 2026-10-21:技能开始像软件包一样被治理
开源·github