小编Chr*_*ast的帖子

在GitHub客户端的上下文中使用git pre-commit钩子

我为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'标志,但这没有任何区别.任何想法如何让客户找到咕噜声?

unix git github github-for-mac gruntjs

10
推荐指数
2
解决办法
7076
查看次数

标签 统计

git ×1

github ×1

github-for-mac ×1

gruntjs ×1

unix ×1