从 Gitlab 镜像到 Github [英] Mirroring from Gitlab to Github
问题描述
我一直在使用私有 Gitlab 实例来保存我的所有代码.但是由于大多数与我一起工作的员工现在都有一个 Github 帐户,我真的很想开始行动并将我的 Gitlab 存储库镜像到 Github.
I have been using a private Gitlab instance to hold all my code. But since most of the staff that work with me now have a Github account, i would really like to get moving and mirror my Gitlab repo to Github.
我的情况:
- 运行 Gitlab(综合)的服务器
- 一个 Github 帐户,我将为其创建一个组织,以便我和我的员工可以一起组织.
我知道 git 中有 --mirror
开关,但我不确定这是如何工作的.我在网上找到的文档非常不稳定......所以如果有人可以帮助我,那就太好了.:)
I know that there is the --mirror
switch in git, but I am not really sure how this is ment to work. Documentation I found online was very wonky... So it would be nice if someone could help me out. :)
推荐答案
GitLab 现在有一个从 UI 执行此操作的选项,请转到 Settings->Repository of your repo:
GitLab has now an option to do this from the UI, go to the Settings->Repository of your repo:
https://gitlab.com/yourUserNameInGitLab/yourRepoName/settings/repository
然后找到选项镜像存储库";并点击展开.您要做的是选择推";镜像方向并填写此网址:
Then find the option "Mirror a repository" and click on expand. What you want to do is choose the "Push" mirror direction and fill this URL:
https://yourUserNameInGitHub@github.com/yourUserNameInGitHub/yourRepoName.git
https://yourUserNameInGitHub@github.com/yourUserNameInGitHub/yourRepoName.git
在密码字段中,您必须使用个人访问令牌(因为 GitHub 现在已弃用密码访问),您可以在此处生成:https://github.com/settings/tokens(生成时不要忘记启用repo"和workflow"权限)
In the password field, you have to use a Personal Access Token (as GitHub has deprecated password access now), which you can generate here: https://github.com/settings/tokens (don't forget to enable the "repo" and "workflow" permissions when generating it)
这篇关于从 Gitlab 镜像到 Github的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!