I started using git-hooks
in my project, and one of precommit-hooks uses clang-format
.
On commit through SourceTree it fails to find clang-format.
Error: 'clang-format' not found.
But commit works, if I do this via terminal or via terminal inside SourceTree. After adding this line to git-hook, everything works in SourceTree.
export PATH=/usr/local/bin:$PATH
So looks like it doesn't work in SourceTree but I haven't found any bugreports about current version (Version 2.3.2)
Did I forget to enable some option somewhere in SourceTree or it should work by itself?
This is still an issue
If using a Mac opening Sourtree from terminal with
open /Applications/SourceTree.app/Contents/MacOS/SourceTree
Fixes the issue by getting the correct path
Or you can change the pre-commit script and add the path there with something like:
export PATH=/usr/local/bin:$PATH
Alternate solutions can be seen in
https://community.atlassian.com/t5/Bitbucket-questions/SourceTree-Hook-failing-because-paths-don-t-seem-to-be-set/qaq-p/274792
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With