- 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
- required the server to be always running, and it has to contains all the github repos in drive.
- problems
- approach 0: a script in a server periodically pulling the change from all github repo to local from github and pushing to gitlab.
- 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
- there is no API to configure the pull mirror in gitlab, so it couldn't be automated.
- [existing feature request]
-
http mirror not possible https://gitlab.com/gitlab-org/gitlab/-/issues/230816
-
http mirror possible https://gitlab.com/gitlab-org/gitlab/-/issues/277415
- add the mirror by https://gitlab.com/gitlab-org/gitlab/-/issues/277415#note_451052345
- [existing feature request]
- even there are api, pull mirror only support password or deploy key
- password: your github account become dangerous
- deploy key:
- have to retrieve the deploy key by program
- seems no easy way of automatically attaching the deploy key to github repo by api ?
- there is no API to configure the pull mirror in gitlab, so it couldn't be automated.
- problems
- 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
- 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:
- all old repository and new repository in Github will be linked to gitlab.
- problems:
- since the server has to add a github action, it means that it has write permission to all github repository, if the server is hacked, hacker could add any commit or change commit history.
- the github action will have write permission to counterpart gitlab repository
- possibly by ssh key set in github secret
- so the secret has to be added by api also, but seems such api doesnt exist yet github secret api
- possibly by ssh key set in github secret
- advantage:
- 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.
- doesnt use gitlab pull mirror or github action to push
Last active
February 24, 2021 01:46
-
-
Save john012343210/6e606eb4f9c9bb2c1fbd6f00dcab24a4 to your computer and use it in GitHub Desktop.
sync github to gitlab
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment