Is it possible to use GIT hooks in .git/hooks/ with Stash?
It would like to know if I can write a simple shell script for the post-receive hook to be run by the server on a git push. It should check out a branch to a webserver.
I was not able to find a word on this anywhere.
Thanks in advance, regards from munich
Jochen
Hi Jochen,
You can use standard git hook scripts with Stash (in addition to Java-based hooks). Just pop them in the <STASH_HOME>/data/repositories/<repo-id>/hooks/post-receive.d directory.
Cheers,
Michael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry for butting in...is there more in depth documentation on this subject somewhere?
Some specific questions off the top of my head:
I can probably work around things in various ways, but in case there are existing ways to achieve them, it'd be nice(r)...
Thanks,
ken1
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kenneth,
There isn't really any documentation about managing raw Git hooks, possibly because it's not necessarily something Stash wants to encourage.
1. I believe you should be able to add them to the global Git templates directory, which is used when new Git repositories are created in Stash. I would recommend using symlinks to the actual script so that when the file is _copied_ it will be a copy of the symlink and not the actual file (which will then get out of sync).
2. Not at the moment. This is something that's a more general problem for most of the repository settings, not just hooks. This might be a good feature request to follow:
https://jira.atlassian.com/browse/STASH-3597
3. Again, not at the moment. Your best bet would be to use our REST api from a local script:
https://developer.atlassian.com/static/rest/stash/latest/stash-rest.html#idp2683712
Cheers,
Charles
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
One thing I forgot to mention - if you do create the templates in the global templates directory make sure you add them to pre-receive.d or post-receive.d, otherwise they won't work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.