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

Pre-push git hook not executing via SourceTree

danhendersonweb
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 12, 2015

Hi,

I have an issue where I have a pre-push git hook, but it is not executing when pushing via SourceTree. If I push via the command line, it executes fine, and that is copying the exact git command that SourceTree is trying to execute.

I have a pre-commit hook which executes correctly from both the command line and SourceTree, so just not sure why SourceTree and my pre-push hook are not playing nice together.

I have dumbed all hooks down to a simple echo statement to ensure there is nothing wrong with the way the hooks were written, and the outcome of each combination is still the same i.e. all hooks execute except for pre-push when using SourceTree.

Any help would be appreciated, thanks.

7 answers

1 vote
Hamilton Teixeira
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 20, 2021

Same issue. Trying 
Using pre-commit hooks not running,
Works only from terminal.

Sourcetree 4.0.2 - Minor Release [4 August 2020]
macOS Big Sur 11.01

1 vote
Vaclav Koldus
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 31, 2018

Still present in 2.7.6. There's something wrong with the environment when not running from terminal. pre-push node hooks don't seem to work at all. When I try to hook up eslint manually, the script executes, but it claims env can't find node. I've got node in the path though. Somehow the git process source tree is creating is not getting it though.

1 vote
Donal O'Brien
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 28, 2017

i still see this on 2.6.3 (134). however, it's happening with a pre-commit hook for me

0 votes
Jacob Muchow
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 21, 2021

Also a bug for me still in 4.0.2 on Big Sur. I just upgraded from version 2.x to see if that would fix it. Opening from cmd line works for me also.

0 votes
Tim Wiel
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 7, 2020

I had this same issue on Mac 10.14.5 with Sourcetree 2.7.6 using pre-commit hooks however upgrading to Sourcetree 3.0.0 fixes the issue and I no longer have to open from terminal

0 votes
ion_tichy
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 6, 2016

I also hereby confirm this bug is alive and kicking in Version 2.1 (2.1)

0 votes
ion_tichy
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 6, 2016

It is worse. I just confirmed some information found at http://stackoverflow.com/questions/17538460/using-git-pre-commit-hooks-in-context-of-github-client/33588294#33588294 that indicates, that executing source tree from the command line (likes so: open /Applications/SourceTree.app/Contents/MacOS/SourceTree) results in the hooks working. 

aamirafridi September 7, 2016

I am using it and its working quite well for me

ClaireElaine O'Malley
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 12, 2017

I also had this error, and applied Jürgen Simon's fix. It works great for me, so long as I remember to open the app from the command line.

Recommend adding an alias to your .bash_profile:

    alias "ost"="open /Applications/SourceTree.app/Contents/MacOS/SourceTree"

or if your SourceTree is installed off your Users/[self]/Applications folder:

    alias "ost"="open ~/Applications/SourceTree.app/Contents/MacOS/SourceTree"

Joe Steele February 9, 2018

This fix works for me (sort of) but shows me a warning on launch. Still launches though. 

Thanks Jürgen Simon!

Here is the warning:

2018-02-09 11:50:36.792 Sourcetree[48868:2392163] [Crashlytics] Version 3.9.3 (128)

2018-02-09 11:50:36.976 Sourcetree[48868:2392163] NSWindow warning: adding an unknown subview: <INMovableByBackgroundContainerView: 0x7f9215adeb20>. Break on NSLog to debug.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events