Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SourceTree breaks Path variable

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?

like image 950
htzfun Avatar asked Mar 16 '17 20:03

htzfun


1 Answers

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

like image 135
Ryan Heitner Avatar answered Dec 10 '22 18:12

Ryan Heitner