对于 GitLab,必须手动为每个存储库设置拉/推镜像。
我想知道那里有any way可以自动将所有 Github 存储库同步到 GitLab,这样
- 当您在 GitHub 中创建新的存储库时,GitLab 中的存储库将自动创建,并充当拉取镜像。
- 对于 Github 中的所有旧存储库,在 GitLab 中设置存储库,其作用类似于拉取镜像。
以下是我的想法:
- proposal:
- doesnt use gitlab pull mirror or github action to push
- approach 0: a script in a server periodically pulling the change from all github repo to local from github and pushing to gitlab.
- problems
- 要求服务器始终运行,并且它必须包含驱动器中的所有 github 存储库。
- use gitlab pull mirror:
- approach 1: when you create a new repo in GitHub, the webhook is sent to a script that could create a GitLab repo, and then setup the mirror
- problems
- gitlab中没有配置pull镜像的API,所以无法自动化。现有功能请求 https://gitlab.com/gitlab-org/gitlab/-/issues/1499
- even there are api, pull mirror only support password or deploy key
- 密码:你的 github 帐户变得危险
- deploy key:
- 必须通过程序检索部署密钥
- 似乎没有简单的方法可以通过 api 自动将部署密钥附加到 github 存储库?
- use github action to act like a push mirror:
- approach 2: a server constantly running to check if any GitHub repo doesnt has a counter part in Gitlab, if found, create a GitLab repo, add a gitHub action by api to that GitHub repository that is set to push the change to the newly created gitlab repo.
- advantage:
- Github 中的所有旧存储库和新存储库都将链接到 gitlab。
- problems:
- 由于服务器必须添加一个github操作,这意味着它对所有github存储库具有写权限,如果服务器被黑客攻击,黑客可以添加任何提交或更改提交历史记录。
- the github action will have write permission to counterpart gitlab repository
- possibly by ssh key set in github secret
- 所以秘密也必须通过api添加,但似乎这样的api还不存在github 秘密 API https://github.community/t/api-to-manage-repo-secrets/16697
目前(对于 Gitlab 版本 13.9)无法自动执行此操作。就像您在问题中所说的那样,必须为您想要镜像的每个存储库手动完成。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)