It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How safe am I editing a repo config or adding bash hooks on the file system?

Justin Shapiro Nov 04, 2013

I'm currently hosting my own git repositories and am thinking of switching to stash. My first thought was to use my current config and hooks for a quicker switchover. I tested them and everything works fine but I am worried about stash coming through and wiping things out. Can I expect stash to respect my repository configurations on the file system or am I reliquishing all control?

1 answer

1 accepted

0 votes
Answer accepted
Charles O'Farrell Nov 04, 2013

Hi Justin,

That depends slightly on what you mean 'config'? Certainly raw Git hooks are supported for the foreseeable future (although we always prefer the use of Stash hooks). You just need to make sure the hooks are in the special pre-receive.d and post-receive.d directories, rather than in 'hooks' as we need to override those - Stash will not function correctly otherwise.

As to the other configuration, it depends. For example we don't block mailmap configuration, as related to your previous Answer's question. But for doing merges and diffs we override certain configuration to ensure that Stash behaves correctly under all circumstances.

Does that make sense and answer your question?


Charles O'Farrell Nov 04, 2013

I should add that we certainly prefer less interference with the raw Git repositories. We reserve the right to take control over Git configuration that Stash relies on it is more likely to behave as advertised with the standard values. Please be careful. :)

Justin Shapiro Nov 05, 2013

I also prefer less interference but I don't think we mean the same thing. ;)

Mostly I create my own sections for use in my hooks per repo. I configure all repos to use the same mailmap file so I could symlink them to .mailmap but config is cleaner imho. I also make use of aliases so I can use the same hooks across repos that have similar but not identical data.

I've got around 300 repos at this point with more coming all the time. If/When I switch to plugins it sure would be nice to be able to clone a std configuration like I do with bamboo or jira. At this point it'll be way easier to copy a script file.

Charles O'Farrell Nov 05, 2013

Hi Justin,

You should be fine then. Let us know if something doesn't behave as you would expect.

At some point we would definitely like to improve the way our repository settings, including hooks, inherit their configuration from projects and the global scope. That's not likely to happen in the short term though.

Best of luck,


Justin Shapiro Nov 05, 2013

I think this is my last question on this topic:

I want to limit users abilities to rewrite history. Can I continue to do this in config as follows or is there a stashy way to do it?

        denyDeleteCurrent = ignore
        denyNonFastForwards = true
        denyDeletes = false

Charles O'Farrell Nov 05, 2013

Hi Justin,

Stash comes bundled with a per-repository hook that can disable fast forwards. Unfortunately it doesn't include branch deletion. My collegue has written an example plugin which might be of interest:

You might also be interested in watching/voting for the following feature request:



Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder :  #!/bin/bash source "$(dirname "$0")/" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

3,242 views 1 22
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you