How can I add a custom git hook to a GitHub Enterprise repo?

后端 未结 3 1001
终归单人心
终归单人心 2021-01-06 03:26

I\'ve fired up an instance of GitHub Enterprise (11.10.272) and created a repository. I\'ve written a pre-receive hook in Ruby which I\'d like to use with that repository.

相关标签:
3条回答
  • 2021-01-06 03:42

    I know that this is really old, but GitHub Enterprise 2.6 just came out with pre-receive hooks. More information can be learned here: https://help.github.com/enterprise/admin/guides/developer-workflow/using-pre-receive-hooks-to-enforce-policy/.

    I'm fairly certain this will perfectly align with the things you are looking for. Hopefully this either helps OP, or anyone else who stumbles upon this later!

    0 讨论(0)
  • 2021-01-06 03:52

    GitHub Enterprise seems to store repostories in /data/repositories. Each repository has hooks generated by a template. I can modify these hooks, but that would surely break something. The template hooks seem to look for hooks in another location, but that location is defined in config and I can't find it.

    0 讨论(0)
  • 2021-01-06 04:01

    Based on my email with GitHub customer support, pre-receive hooks aren't supported for GitHub Enterprise as of May 2013.

    We don't have admin access on our GHE box, so we couldn't go in and "fix" this if we wanted to.

    They claim that things they do would break if you could reject commits. I assume they mean things like automatic merging of pull requests, but I'm not sure.

    They have an extensive set of post-commit webhooks which you could use for post-commit functionality.

    I'm looking into building a "pass-through git server" -- basically, poll the GHE API frequently to make a local clone of any repo that exists on certain GHE accounts, and then auto-clone it with custom pre-recieve and post-receive hooks. This would let us clone off the pass-through server, do our pre-receive hooks there, and push approved changes through to GHE. There doesn't seem to be any kind of standard pass-through server for git out there yet, probably because you need to know what repos to clone, which doesn't seem to have a standard git API.

    0 讨论(0)
提交回复
热议问题