【发布时间】:2016-09-18 12:44:22
【问题描述】:
我在服务器上配置了一个 post-receive 挂钩脚本,用于使用 Git 自动部署,例如 here 所述。
所以,当我在本地 PC 上时,我会在生产服务器上发送推送:
git push production master
post-receive 钩子被触发,复制实时目录中存储库的内容。
我的问题是,当我发送推送时,是否有某种方法可以将某些参数传递给 post-receive 挂钩?
类似这样的:
git push production master --params="clear-the-cache=1"
然后在钩子中我可以读取'clear-the-cache=1' 参数并执行其他操作。
有办法吗?
【问题讨论】:
-
post-receive钩子本身不带任何参数。也许您可以从某个配置文件中读取clear-the-cache=1,您已将其添加到存储库中。
标签: git deployment hook githooks git-push