STASH Licenses + Hooks

I have a few questions on hand:
We have requested about a 100 licenses for initial Stash Deployment.. Now we have an inhouse crowd server that we want to connect to, but that server has about 1000 users. Would we be able to connect to this crowd server considering the number of licenses requested ???
Currently git supports Global Hooks and repository level hooks. I am trying to use global hooks at the git level via STASH.
Meaning I dont plan to add anything at the STASH level but plan to do so at the GIT server level and I want to see if STASH will be able to handle that.. Is this possible, if so then if you can provide some examples, that would be really helpful..

5 answers

1 vote

Hey Ishan,

EDIT: you should still be able to put hooks in the global git template as mentioned on the link you described and the hooks will be copied into every new or forked repo created by Stash.

You might want to have a look at STASH-3597 and vote for that issue as well.

Best regards,

Thiago Bomfim

Atlassian Support

0 votes

Hello Ishan,


As per the "Integrating Crowd with Atlassian Stash" document, the first step you have to take is to configure Crowd so that Stash will be able to connect to it. There is another step in which you will have to configure a specific set of users that can log in to Stash. Hence, not all your Crowd user base will have to be sychronized with Stash but only the ones you configure.


Stash is a Git repository management tool. So that means you are able to do anything Git allows you to. The Repository System Info Plugin enables you to see the location of your repositories on disk and you can add the hooks to your Git repositories once you know their path. You can see some examples here.

However, you might want to start doing at "Stash level" after reading Hooked on Stash.

Hey Thiago,

Here is what I think how Global Hooks in git work:

-> There is a template that a user can create and then initialize using "git config --global init.templatedir '~/.git_template'" and then every repo that I have created can use this template and hoks within this template..

-> Here is what I tried with STASH:

I created a repo and hooks within it, then I forked that repo assuming that the hooks get copied over, but it seems that is not the case.. So how can I implement global hooks at git level for STASH ??



Hi Ishan,

When you fork in Stash we're just doing a 'git clone', which doesn't normally copy hooks. Stash is no different.

While I don't recommend in general that you use raw Git hooks, you should still be able to put your hooks in the global git template directory and they should be copied into every new or forked repository that is created in Stash. Please let me know if that's not the case.

I would also thinking about making your hooks in the template directory symlinks so that if you need to make changes you can do it once and not have to update your hooks in Stash.

I would definitely vote/watch the issue that Thiago mentioned below. Managing global hooks in Stash would be the ideal situation. Although I should warn you if/when we implement that feature it is likely to only be Java/Plugin hooks, not the normal Git scripts.



Hey Charles,

Yes even I plan to use Java/Plugin Hooks soon.. But for now we have needs that needs to be accomplished soon enough.. So I will try out your suggestion..

One question I had on STASH/git side is, in general how can I check if the git push is a branch creation ??

meaning : git branch abc, git checkout abc, git push origin abc.

Now how can I know that this push is a branch checkout ?? I am looking for a git command.

One way I thought of is that during any push, git passes old change + new change and the branch name. If the old change is "00000000000" then that means its a branch creation, if not then its an existing branch..

Please correct me if I am wrong !!



Hi Ishan,

That's exactly what you can do. If the old change is the null SHA (40 0's) then it's a new ref (branch/tag/whatever) and if the new changes is the null SHA then it's a ref deletion.

Does that help?


Thanks Charles, that confirms one scenario..

Now there is a sticky part here, assuming the scenario below:

git branch abc, git checkout abc, making changes in the branch, git commit -a -m "fixing stuff", git push origin abc

Here initially I used to do : git rev-list old_change..latest_change . But here if I take the latest_change and do:

git cat-file commit latest_change | sed '1,/^$/d'.

It returns does not give me the latest changeset SHA, am I missing something here ???

Hi Ishan,

What are you using cat-file for? Testing that regex it looks like that would return you the commit message on 'latest_change'. Don't you already have the latest changeset? Sorry, I'm not quite sure what you're trying to do. Can you post your hook?


Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

1,959 views 7 10
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