How to use Git Secrets with SourceTree?

Hi all,

our team decided to use "Git Secrets" (a fork of in order to prevent team members to accidentally commit secrets (password, API Keys, ...) to Git. I also should mention that we're working on Mac OS X.

Using Git Secrets from the command line works just fine, and the new git command "git secrets <options>" is available. I figure this works as the command line has access to the PATH in which the respective scripts are being installed by Git Secrets. Git Secrets installs a special pre-commit-hook which checks what is has to check before allowing to commit.

Committing from within SourceTree however does not work anymore.

This is the error message I get:


git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree commit -q -F /var/folders/xn/1hl03gp55_3df0y1xl37tg900000gp/T/SourceTreeTemp.xNvMuf 
git: 'secrets' is not a git command. See 'git --help'.
Completed with errors, see above


My guess is that SourceTree does not have access to the PATH under which the additional command "secrets" is available. What brings me to this conclusion is the fact, that committing from within SourceTree does not work, if I start SourceTree from the Dock or via Spotlight. However, if I manually start SourceTree from the command line (by manually calling "/Applications/") it does work again.


So, my question:

Is there a way to configure things like this in SourceTree? Can I e.g. manually add a PATH and make it known to SourceTree? Or is there any other way around this in order to being able to commit from SourceTree again?


Thank you so much in advance for your help.





1 answer

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Oct 23, 2018 in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

965 views 4 2
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you