git - 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 之后但在构建之前自行克隆子模块吗?
解决方案
在 Heroku 上使用 GitHub repo 子模块的唯一问题是:
- 通过 GitHub Sync(您必须使用自定义 buildpack)
- 激活 GitHub 2FA(您可以使用 PAT、Personal Access Token 声明您的子模块 URL,但范围是 read/write,如此处所述)
推荐阅读
- php - php获取字符串中的特定单词
- windows-services - 用于捕获服务挂起的 Procdump
- java - 无法使用 JRE 10 运行简单的 Java 应用程序
- angular - Angular 6 多次调用服务而不是一次
- .net-core - Service Fabric 本地群集使用哪个端口连接到外部服务(例如,Azure Blob 存储)?
- haskell - bind 可以由 fmap 和 join 组成,所以我们必须使用 monadic 函数 a -> mb 吗?
- python - 以类似“单元”的方式使用标准张量流层
- angular - 使用 as 关键字时,有没有办法在角度模板中保留类型?
- python-2.7 - 带有字典的类 python
- c# - 水晶报表隐藏过滤之谜