Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

faild to executor git hook for clang-format

杨闯 March 28, 2023

I had add an git hook when commit code it will do code format check . the executor command  run in sourcetree always got an error  like this :

bash /myresponsedir/git_hook/hooks/commit-msg-hook/

======start git format========

[0;31m please install clang-format, mac: brew install clang-format [0m


the git hook can works fine in terminal. but failed in sourcetree.  

In previous version i remember it works fine in sourcetree, but when I update to 4.2.2(250), it always failed.


2 answers

0 votes
杨闯 April 7, 2023

can anybody help me with this git hook problem? 

0 votes
Oday Rafeh
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 28, 2023

Hi @杨闯 

It's possible that the environment variables or paths set up in your terminal are not the same as those set up in Sourcetree.

You can try adding the path to clang-format to your Sourcetree environment variables.

To do this, go to Sourcetree > Preferences > Advanced, and under "Environment Variables", add a new variable with the path to clang-format.

For example, if you installed clang-format using Homebrew, the path might be /usr/local/opt/llvm/bin/clang-format.

After adding the variable, try running the hook again in Sourcetree to see if it works.

杨闯 March 28, 2023

there's no environment config in Advanced setting page.  it's on mac platformscreenshot-20230328-163300.png

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events