在镜像仓库中的 git 中调用 post-receive 钩子
我正在使用 trac,我需要调用安装了 trac 的接收后挂钩服务器。主存储库位于 github 中,因此我将 github 存储库克隆到本地服务器
git clone --mirror ** **
,当我运行
git fetch --all
时,我希望 git 将运行 post-receive 挂钩。是否可以?
I'm using trac and I need to call post-receive hook server where trac is installed. Main repository is located in github, so I cloned github repo to local server
git clone --mirror ** **
and when I'm running
git fetch --all
I want, that git will run post-receive hook. Is it possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当有人推送时,接收后挂钩会在服务器上运行。没有任何东西会在提取后运行,假设运行提取的人可以在之后直接运行其他命令(或作为 shell 脚本的一部分)来执行所需的操作。
我完全无法准确地破译你想在什么地方、什么情况下运行什么命令。如果您试图使 trac 服务器的 git 存储库保持最新,您可以要求 github 在收到提交时发送电子邮件或 TCP 连接或其他内容。该电子邮件/TCP 连接/等可能会触发所需的拉/取或其他操作。另一种选择是每小时轮询一次 github 或其他。
如果上述内容还不够,进一步解释您想要的内容会很好。
The post-receive hook runs on the server when someone pushes so it. There is nothing which runs post-fetch, under the assumption that whomever run the fetch could run some other command directly afterwards (or as part of a shell script) which performs the desired action.
I was entirely unable to decipher exactly what command you wanted to run where and under what circumstance. If you are trying to keep the trac server's git repo up to date, you can ask github to send email or a tcp connection or something when it receives a commit. That email/TCP connection/etc could trigger the desired pull/fetch or whatever. Another option is to poll github every hour or whatever.
Further explanation of what you want would be good if the above is insufficient.