I've recently noticed that linting errors are not caught with our pre-commit hooks.
At first I thought it's a problem with lint-staged or husky but eventually found that SourceTree on Mac just skips the commit hooks.
Committing from the command line or IDE works ok (pre-commit runs).
As the commit window closes quickly, I didn't even know what was the problem.
Only after checking Preferences > Advanced > Always display full console output, I saw the following:
git --no-optional-locks -c color.branch=false -c color.diff=false -c color.status=false -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree commit -q -F /var/folders/vj/md8l7z_52v751h494yhrjr580000gn/T/SourceTreeTemp.B8F4vi
Can't find yarn in PATH: /Applications/Sourcetree.app/Contents/Resources/git_local/libexec/git-core:/Applications/Sourcetree.app/Contents/Resources/bin:/Applications/Sourcetree.app/Contents/Resources/git_local/bin:/Applications/Sourcetree.app/Contents/Resources/git_local/gitflow:/Applications/Sourcetree.app/Contents/Resources/git_local/git-lfs:/usr/bin:/bin:/usr/sbin:/sbin
Skipping pre-commit hook
Completed successfully
After spending several hours trying to fix it, without luck, I checked with other developers if they have the issue as well, and indeed, they had the same issue.
Observed on different versions of SourceTree and macOS:
SourceTree 3.x on macOS 10.15.1.
SourceTree 4.0.1 on macOS 10.14.6.
Also the PATH error can be other things like:
Can't find node in PATH
Can't find npx in PATH
Basically the issue is that /usr/local/bin is not in the PATH list.
This is really disheartening (making us doubt the reliability of SourceTree).
Please give this issue priority.
Thanks.
- is related to
-
SRCTREE-8025 GIT pre-commit hooks do not work
- Closed
-
SRCTREE-8015 Hooks don't load the zshrc
- Closed
- relates to
-
SRCTREE-7797 Replace environement variable in a pre-commit
- Closed