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

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

问题描述

在一个团队中,我们设置了一个仅对我们的团队可用的 gitlab,用于开发目的、推送、分支等,我们有一个官方 git 存储库,我们希望仅将来自 master 分支的提交镜像到该存储库(稳定).

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 hook 将提交转发到另一个 git repo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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