在一个项目中,我们使用 Husky,但是当我尝试使用 git add 添加提交时。和 git commit -m "test",我收到以下错误
.husky/pre-commit: 2: .: 打不开 .husky/_/husky.sh
我该如何解决这个问题?
我的操作系统是 Windows,但我在这个项目上使用 Ubuntu
husky.sh 的代码也在下面
if [ -z "$husky_skip_init" ]; then
debug () {
if [ "$HUSKY_DEBUG" = "1" ]; then
echo "husky (debug) - $1"
fi
}
readonly hook_name="$(basename "$0")"
debug "starting $hook_name..."
if [ "$HUSKY" = "0" ]; then
debug "HUSKY env variable is set to 0, skipping hook"
exit 0
fi
if [ -f ~/.huskyrc ]; then
debug "sourcing ~/.huskyrc"
. ~/.huskyrc
fi
export readonly husky_skip_init=1
sh -e "$0" "$@"
exitCode="$?"
if [ $exitCode != 0 ]; then
echo "husky - $hook_name hook exited with code $exitCode (error)"
fi
exit $exitCode
fi