我为git创建了一个预提交脚本,它在通过命令行运行时工作正常.这是脚本:
#!/bin/sh
#
# Pre-commit hooks
echo "Running unit tests..."
# Lint stuff before commiting
grunt runtests
RESULT=$?
[ $RESULT -ne 0 ] && echo "Tests (or tasks) failed, aborting the commit" && exit 1
echo "All tests passed, commiting your changes" && exit 0
Run Code Online (Sandbox Code Playgroud)
我希望预提交也可以通过GitHub客户端应用程序工作,但我不能让它工作.执行预提交脚本,但它会引发错误.这是它在客户端警报窗口中返回的全文:
Running unit tests...
.git/hooks/pre-commit: line 7: grunt: command not found
Tests (or tasks) failed, aborting the commit
(1)
Run Code Online (Sandbox Code Playgroud)
出于某种原因,它无法找到咕噜声.我再次重新安装了grunt cli并使用了全局'-g'标志,但这没有任何区别.任何想法如何让客户找到咕噜声?