我想将每个文件的内容推送到 git repo,并将文件内容存储在 MySQL 中。一个快速的谷歌和阅读说我需要使用提交后挂钩挂钩到 git。但是,实际的 post-commit 钩子在提交中循环遍历每个文件是什么样子的?
是否有用于执行此操作的预建库?首选 PHP、Node.js 或纯 Bash。
谢谢。
我想将每个文件的内容推送到 git repo,并将文件内容存储在 MySQL 中。一个快速的谷歌和阅读说我需要使用提交后挂钩挂钩到 git。但是,实际的 post-commit 钩子在提交中循环遍历每个文件是什么样子的?
是否有用于执行此操作的预建库?首选 PHP、Node.js 或纯 Bash。
谢谢。
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.