当一个 git 项目包含子模块(submodule) 时,直接克隆下来的子模块目录里面是空的。
有两种方法解决:
如果项目已经克隆到了本地,执行下面的步骤:
git submodule init更新项目,抓取子模块内容。
git submodule update
另外一种更简单的方法,就是在执行 git clone 时加上 --recursive 参数。它会自动初始化并更新每一个子模块。例如:
git clone --recursive https://github.com/example/example.git
关于 git 子模块更多内容,参见官方文档。
更多技术文章,请访问我的个人网站:https://www.codingbit.net
原文:https://www.cnblogs.com/codingbit/p/git-clone-with-submodule.html