• 请不要在回答技术问题时复制粘贴 AI 生成的内容
dunhanson
V2EX  ›  程序员

两个独立的 gitlab 如何进行代码定时同步?

  •  
  •   dunhanson · Jul 25, 2021 · 2689 views
    This topic created in 1769 days ago, the information mentioned may be changed or developed.

    生产环境(阿里云)也部署了一个 gitlab,想用于生产的 jenkins 部署拉取代码然后走内网,这样速度快点。

    但是实际工作的 gitlab 仓库在本地的环境,所以两个 gitlab 怎么进行代码同步,不知道有什么好的方案?

    我自己想到的一个方案是,写一个定时任务,拉取项目代码然后 push 到阿里云的 gitlab

    W2gj61.png

    4 replies    2021-07-25 21:44:27 +08:00
    qinxi
        1
    qinxi  
       Jul 25, 2021
    内网项目配置一下阿里云 gitlib 作为镜像仓库: 项目-用户设置-仓库-镜像仓库
    Mitt
        2
    Mitt  
       Jul 25, 2021
    创建一个 webhook trigger,每次 push 到本地 gitlab 都自动 push 到阿里云
    debuggerx
        3
    debuggerx  
       Jul 25, 2021 via Android
    不用这么麻烦的……只要在工作 gitlab 项目的"设置"=>"仓库"页面的"镜像仓库"功能面板设置一下镜像地址,然后所有 push 操作就都可以自动同步到设置的 git 地址上了 我就是这样把公司 gitlab 上的代码实时备份到 gitea 上的
    说明文档在这里:
    https://docs.gitlab.com/ee/user/project/repository/repository_mirroring.html
    dunhanson
        4
    dunhanson  
    OP
       Jul 25, 2021
    @qinxi @debuggerx @Mitt 好的,谢谢,我看下你们说的方法
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   922 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 19:27 · PVG 03:27 · LAX 12:27 · JFK 15:27
    ♥ Do have faith in what you're doing.