Hi,
I have a pre-commit hook that calls grunt to lint before checking in. When commiting from the command line it works fine. When commiting via SourceTree it doesn't work. The pre-commit hook runs...
#!/bin/sh
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
ROOT="$(git rev-parse --show-toplevel)"
cd $ROOT
git stash -q --keep-index
cd $ROOT/build
/usr/local/bin/grunt $BRANCH
RESULT=$?
cd $ROOT
git stash pop -q
[ $RESULT -ne 0 ] && exit 1
exit 0
gives the error :
git -c diff.mnemonicprefix=false -c core.quotepath=false commit -q -F /var/folders/Ta/Ta3HaDmvGz8e5G+8MKxNvLtVItU/-Tmp-/SourceTreeTemp.bXmip3
env: node: No such file or directory
Completed with errors, see above
If I try to run the ST generated git command from the shell manually it works fine too, so I'm guessing it's something up with the paths. I tried creating a launchctl.conf and adding /usr/local/bin to it but that didn't change the error. The path appears to be correct in env.
> which node
/usr/local/bin/node
> env | grep /usr/local/bin
PATH=/usr/local/share/python:/usr/local/opt/php54/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/adamr/bin:/Users/adamr/Applications/AWS-ElasticBeanstalk-CLI-2-1.3/eb/macosx/python2.7:/Users/adamr/Applications/AWS-ElasticBeanstalk-CLI-2-1.3/api/bin
Thanks,
Adam