How to use Git Secrets with SourceTree?

Andreas Maly May 3, 2016

Hi all,

our team decided to use "Git Secrets" (a fork of https://github.com/awslabs/git-secrets) 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/SourceTree.app/Contents/MacOS/SourceTree") 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.

 

Cheers,

Andy

 

1 answer

0 votes
Ryu Yamashita February 6, 2017

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events