Gitlab的post-receive/update钩子将提交转发到另一个git repo [英] Gitlab post-receive/update hook to forward a commit to another git repo

查看:191
本文介绍了Gitlab的post-receive/update钩子将提交转发到另一个git repo的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个团队中,我们建立了一个gitlab,该gitlab仅对我们的团队可用,并且用于开发,推送,分支等目的,并且我们有一个正式的git repo,我们仅希望将其反映到主分支的提交(稳定).

In a team we have a gitlab set up that is avialable only to our team and is meant for development purposes, pushing, branching etc and we have an official git repo to which we would like to mirror commits only from master branch (stable).

我知道这可以通过使用服务器端git钩子来完成,但是我具体如何做到这一点,以使开发人员不必额外键入任何内容,并且该钩子将在gitlab上设置(在开发人员的上则无此设置)机器-本地存储库)?

I know that this can be done with use of server-side git hooks but how specifically can I do that so that the developers won't have to type anything extra and the hook will be set on gitlab (no on developers' machines - local repos) ?

推荐答案

看看此食谱.在作者将要推送到主服务器的更改传播到工作树的食谱中,您需要将代码的那一部分用另一个git push替换到您的公共服务器上.

Take a look at this recipe. In the recipe the author propagates changes being pushed to the master to a working tree, you need to replace that part of the code with another git push to your public server.

这篇关于Gitlab的post-receive/update钩子将提交转发到另一个git repo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆