Terraspace Bundle: ERROR: There was a git error - fatal: not a git repository (or any of the parent directories): .git

Terraspace Bundle: ERROR: There was a git error - fatal: not a git repository (or any of the parent directories): .git

当我 运行 terraspace bundle 我看到以下错误消息:

Bundling with Terrafile...
ERROR: There was a git error
Current dir: /private/tmp/terraspace/bundler/cache/github.com/cloudposse/terraform-aws-cloudfront-s3-cdn
The error occur when running:
git pull 2>&1
fatal: not a git repository (or any of the parent directories): .git

我的 Terrafile 中只有某些模块似乎有这个问题,因为我可以通过注释掉那些失败的模块来绕过这个问题。

我决定在每个失败的模块上尝试 rm -rf /private/tmp/terraspace/bundler/cache/<module>

在我这样做之后模块安装正确:

Bundling with Terrafile...
Exporting aws-iam-role
Exporting ecr
Exporting iam-system-user
Exporting s3-cdn
Modules saved to vendor/modules

我不确定缓存损坏的根本原因。