V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
honglongmen
V2EX  ›  程序员

自建的 gitlab 如何和自 github 导入的项目保持代码一直更新?

  •  
  •   honglongmen · 2019-03-25 05:23:49 +08:00 · 4801 次点击
    这是一个创建于 1830 天前的主题,其中的信息可能已经有所发展或是发生改变。

    自己建了个 gitlab,从 github 导入了几个不错的项目玩玩, 请问如何保持自己 gitlab 上项目代码和 github 原始代码同步更新?

    11 条回复    2019-03-25 19:07:12 +08:00
    Sharuru
        1
    Sharuru  
       2019-03-25 06:16:56 +08:00 via Android
    Gitlab EE 版本及以上有 Mirror 功能可以定时同步。
    CE 版本的话,cron 自己写个定时任务,大概三行就完事儿了。
    或者再稍微复杂点听 webhook 也是可以的。
    msg7086
        2
    msg7086  
       2019-03-25 10:25:59 +08:00 via Android
    自己拉推。
    daimazha
        3
    daimazha  
       2019-03-25 11:06:49 +08:00
    添加个 github 项目的 remote, 自己拉 merge
    Rwing
        4
    Rwing  
       2019-03-25 11:13:57 +08:00
    https://github.com/samrocketman/gitlab-mirrors

    The gitlab-mirrors project is designed to fill in a feature which is currently missing from GitLab: the ability to mirror remote repositories. gitlab-mirrors creates read only copies of remote repositories in gitlab. It provides a CLI management interface for managing the mirrored repositories (e.g. add, delete, update) so that an admin may regularly update all mirrors using crontab. It operates by interacting with the GitLab API using python-gitlab.
    honglongmen
        5
    honglongmen  
    OP
       2019-03-25 11:24:53 +08:00
    @Sharuru cron 如何操作? CE 版本的.
    joesonw
        6
    joesonw  
       2019-03-25 13:30:51 +08:00
    @honglongmen `git pull origin master` `git push remote master` ????
    ospider
        7
    ospider  
       2019-03-25 13:52:45 +08:00
    换 gitea 吧,gitlab 那么臃肿。。
    HangoX
        8
    HangoX  
       2019-03-25 14:01:08 +08:00
    gitlab 本身在 setting 中支持 mirror 功能
    honglongmen
        9
    honglongmen  
    OP
       2019-03-25 14:58:09 +08:00
    @HangoX 我是看到了 Mirror,但是不知道怎么用.
    honglongmen
        10
    honglongmen  
    OP
       2019-03-25 15:05:00 +08:00
    @HangoX https://code.xxx.com/help/workflow/repository_mirroring ,看到了帮助,但是只支持 Push 到 mirror 仓库,而我是想反过来,github push 到 gitlab,难道只能在 github 先 fork 然后 github 上 push?
    HangoX
        11
    HangoX  
       2019-03-25 19:07:12 +08:00
    gitlab 官方版本 push 和 pull 都支持,不知道自己建的版本是否支持。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   952 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 21:06 · PVG 05:06 · LAX 14:06 · JFK 17:06
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.