I would like to take the contents of each file pushed to a git repo, and store the file contents in MySQL. A quick google and read says I need to hook into git using a post-commit hook. However, what does the actual post-commit hook look like to loop through each file in the commit?
Is there a pre-built library for doing this? Prefer PHP, Node.js, or pure Bash.
Thanks.
you don't need a hook if you just do a cron job to poll for any changes and then iterate through the new objects via git ls-tree and git show.
You can also get a local script to be triggered by github hooks (they just trigger the script and you can only customize endpoints).
You can use client side hooks as some have alluded to in the comments. But you need something on the side of where commits are going to be pushed to, so that implies server side hooks.