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

Is there a way to download pre-push git-hooks from Stash to SourceTree?

Swift Capital April 8, 2015

Is there a way to integrate SourceTree with Stash or BitBucket, such that a pre-push git-hook could be specified server-side, and automatically installed on SourceTree clients?

This is not about pre-receive git-hooks. We're specifically looking for a way to deploy a pre-push git-hook to everyone on the team.

4 answers

1 accepted

3 votes
Answer accepted
TimP
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.
April 8, 2015

The usual pattern for this is to commit the hook to the repository (e.g. hooks/pre-push) and then get each team member to symlink (or copy) it into their .git/hooks directory:

ln -s hooks/pre-push .git/hooks/pre-push

There is no way to enforce that a git hook runs on the client-side, you must rely on your developers to install it themselves (I usually document the process in the repositories README) and, for important hooks - e.g. running tests or lint tools - run them on the server as well.  

Swift Capital April 9, 2015

I'm accepting this answer, although I'm also putting in a suggestion for SourceTree. We're always looking for ways to utilize team settings to enforce standards.

0 votes
Midori
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.
June 14, 2016

As Tim writes, this is an unsolved problem, normally addressed with conventions.

With the Commit Policy Plugin, we use a different approach to install dynamically generated client-side commit-msg scripts:

  1. The script, composed of multiple files, are dynamically generated on the server
  2. Those are delivered to the user as a ZIP file after he selected some options in a wizard interface
  3. After the ZIP is downloaded, he needs to extract this, and we provide a simple step-by-step for that in the same wizard

So far, it works fine. (As the scripts are dynamic, we can't include them directly in the repo content.)

 

0 votes
Swift Capital April 8, 2015

We're looking to enforce "all unit tests and integration tests must be run before a push". While we have these running on the server to, we'd rather our devs be pro-active then re-active when it comes to hunting down problem areas.

0 votes
JamieA
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.
April 8, 2015

I don't believe there is. Out of interest, roughly what do you want to do in the client side hook?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events