首页 > 解决方案 > Git clone 不会自动克隆子模块,导致 heroku 自动部署出现问题

问题描述

我有一个带有子模块的 git repo,我想在自动部署的管道上部署到 heroku,但是当该ng build --prod过程接近完成时,我收到错误

ERROR in : Couldn't resolve resource ./repo/style.css relative to /tmp/build_d3089108a84fd9e7fb117fed84b787b6/src/app/resume/resume.component.ts

因为我的子模块(存在于/src/app/resume/repo)在文件中被引用resume.component.ts

@Component({
  selector: 'app-resume',
  templateUrl: './repo/resume.html',
  styleUrls: ['./repo/style.css']
})

尽管 github repo 指向子模块的特定提交,但初始 git clone 不会克隆它旁边的子模块。

我的.gitmodules文件如下:

[submodule "Resume"]
    path = src/app/resume/repo
    url = https://github.com/<my username>/Resume.git

问题:

有没有办法强制 heroku-git 在完整仓库的同时克隆子模块?

我可以运行一个脚本,让 heroku 在克隆完整 repo 之后但在构建之前自行克隆子模块吗?

标签: githerokugit-submodules

解决方案


在 Heroku 上使用 GitHub repo 子模块的唯一问题是:


推荐阅读