克隆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
相关推荐
坐吃山猪15 小时前
Python进度条
linux·服务器·python
IMPYLH16 小时前
Linux 的 b2sum 命令
linux·运维·服务器·bash
celeste031016 小时前
Redis Summary
linux·运维·服务器·redis·笔记
Sylvan.C16 小时前
Windows+Ubuntu 双系统安装超详细保姆级教程2026,包括系统安装、英伟达独显驱动安装以及双系统时间同步的所有过程
linux·运维·ubuntu
伴我与影16 小时前
Ubuntu 安装 NVIDIA 显卡驱动
linux·运维·ubuntu
unsynchronized16 小时前
OpenClaw 安装指南:Linux 与 Windows 系统详细教程
linux·运维·windows·ai
宁波阿成17 小时前
OpenClaw 在 Ubuntu 22.04.5 LTS 上的命令版操作手册
linux·运维·ubuntu·openclaw·龙虾
林姜泽樾17 小时前
Linux入门第十三章,chmod命令和权限控制信息
linux·运维·服务器·centos
是小小张呀17 小时前
WSL Ubuntu修改主机名重启后失效解决方案
linux
一个有温度的技术博主18 小时前
Redis系列三:在linux上安装Redis
linux·数据库·redis