java 的 SourceTree 预提交失败

SourceTree pre-commit fails for java

我有一个非常简单的预提交:

PATH=$PATH:/usr/local/bin:/usr/local/sbin
./mvnw test
mvn test

当我从命令行 运行 时 git commit 一切都很好。

然而,当我尝试在 sourcetree 中提交时,它失败并出现以下错误:

Unable to find any JVMs matching version "(null)".
No Java runtime present, try --request to install.
Unable to find a $JAVA_HOME at "/usr", continuing with system-provided Java...
No Java runtime present, requesting install.
.git/hooks/pre-commit: line 3: mvn: command not found

这表明它没有获取我的 $JAVA_HOME 或无法找到 mvn 安装在这台机器上我将第一行添加到预提交中。知道如何通过 sourcetree 传递此信息吗?

找到答案是从命令行打开应用程序:

打开 /Applications/SourceTree.app/Contents/MacOS/SourceTree

在此处找到答案:

https://community.atlassian.com/t5/Bitbucket-questions/SourceTree-Hook-failing-because-paths-don-t-seem-to-be-set/qaq-p/274792