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

2019-03-25 05:23:49 +08:00
 honglongmen

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

4838 次点击
所在节点    程序员
11 条回复
Sharuru
2019-03-25 06:16:56 +08:00
Gitlab EE 版本及以上有 Mirror 功能可以定时同步。
CE 版本的话,cron 自己写个定时任务,大概三行就完事儿了。
或者再稍微复杂点听 webhook 也是可以的。
msg7086
2019-03-25 10:25:59 +08:00
自己拉推。
daimazha
2019-03-25 11:06:49 +08:00
添加个 github 项目的 remote, 自己拉 merge
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
2019-03-25 11:24:53 +08:00
@Sharuru cron 如何操作? CE 版本的.
joesonw
2019-03-25 13:30:51 +08:00
@honglongmen `git pull origin master` `git push remote master` ????
ospider
2019-03-25 13:52:45 +08:00
换 gitea 吧,gitlab 那么臃肿。。
HangoX
2019-03-25 14:01:08 +08:00
gitlab 本身在 setting 中支持 mirror 功能
honglongmen
2019-03-25 14:58:09 +08:00
@HangoX 我是看到了 Mirror,但是不知道怎么用.
honglongmen
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
2019-03-25 19:07:12 +08:00
gitlab 官方版本 push 和 pull 都支持,不知道自己建的版本是否支持。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/548121

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX