Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我找不到任何用于 Windows 的 Git 挂钩的明确示例。我在 Windows 服务器上使用 Bonobo Git 服务器。我需要作为 cmd 或 bat 的 pre-commit 和 post-commit 钩子。预提交应检查空评论,提交后应发送有关提交的电子邮件通知。可能有人有类似的钩子并准备分享吗?
经过一些实验,我发现
#!/Git/sh echo This is the receive-hook >> result.txt
在
C:\inetput\wwwroot\Bonobo.Git.Server\App_Data\Repository\<your repository>\hooks\receive-hook
在远程执行
git push
然后你可以调用一个批处理
#!/Git/sh cmd //C "post-receive.cmd"