IntelliJ - Git 挂钩:terraform:找不到命令

问题描述 投票:0回答:1

环境:

  • 噗!_操作系统 22.04 LTS
  • 哦我的zsh
  • IntelliJ IDEA 2023.2.5(社区版)

问题:

我有一个 git hook

pre-commit
全局设置如下:

git config --global core.hooksPath <PATH_TO_HOOK_FILE>

在这个 git hook 中,我像这样调用 terraform 命令:

terraform fmt
terraform init
terraform plan

我已经使用 homebrew 安装了 terraform

在我机器上的ANY git 项目内的终端中,当我尝试提交时,一切都像魅力一样工作:

git commit -m "My commit message"
inventories.tf
module.tf
Success! The configuration is valid.

[main 559149a] My commit message
 3 file changed, 6 insertion(+), 5 deletion(-)

但是当我使用

IntelliJ Idea
->
Commit view
提交时,我遇到了这个错误:

/home/.../pre-commit: line 57: terraform: command not found

当我将其更改为 hooks 文件内命令的完整路径(即 /toto/titi/terraform)时,它就可以工作了。

所以我的问题是:我如何告诉 IntelliJ Terraform 可执行文件在哪里?

我已经尝试在

Settings
->
Tools
->
Terraform
(不起作用)中设置完整路径,甚至在“提交”选项中选择“Terraform fmt”也不起作用。

git intellij-idea terraform githooks
1个回答
0
投票

Ide 应该从默认终端继承环境变量。如果在终端中检测到这些路径,您可以在终端中启动IDE吗?

© www.soinside.com 2019 - 2024. All rights reserved.