github server-side git hooks (i.e. pre-commit and post-commit)
For obvious reasons, GitHub won’t allow you to execute arbitrary code on their servers as part of Git hooks. The only hooking they allow is through their webhooks or the integrated third-party services.
If you need to run some custom code, you will have to host that somewhere and set up a webhook to run it on your own server.
Marcin
If you're thinking about kicking off a data project, or need to upgrade your data systems let me know. I'm an experienced data engineer, with partners and subcontractors available to take on any project you need.
Updated on June 25, 2022Comments
-
Marcin about 2 years
I've looked around the answers on SO, and the web, and I can't see anything on how to set up a server-side git hook on github (as opposed to webhooks). Is there a way to do this?
Or alternatively, is there a way to set it up so that .git/hooks is a symlink to a part of the working tree at the time of cloning?
I should add that this is an internally-hosted github server.
-
Marcin over 10 yearsOK, but what if I have my own github server? And what about changing .git/hooks in the repo?
-
poke over 10 yearsYou mean GitHub Enterprise? See this question.
-
dtc over 3 yearsI mean I wouldn't say it's obvious but definitely good to know.
-
coder.in.me about 2 yearsIt's not obvious particularly given that GitHub Actions allows arbitrary code executions. The difference is Actions run within VMs. There's no reason why server-side hooks couldn't be run within containers or k8s pods. I would say it's GitHub's decision not to support this.