将存储库从Github移至Gitlab [英] Move a repository from Github to Gitlab

查看:51
本文介绍了将存储库从Github移至Gitlab的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将整个存储库从Github移至GitLab?

对于代码本身,这很简单,只需在GitLab上创建一个新的仓库并推送到仓库即可.

Wiki页面位于Github上的一个单独分支中,并通过Git机制进行管理;AFAIK对GitLab也是如此.页面的故事也一样.

这将问题和合并请求作为主要的开放点.有没有办法将它们从Github复制到GitLab,至少处于迁移时的状态?

Github提供了导出功能,而GitLab具有可以导入Github存储库的导入功能-上面的这些功能有帮助吗?

解决方案

GitLab的导入功能运行良好.

  • https://gitlab.com 上(确保您已登录),您将获得您的列表.项目.点击新项目.
  • 打开导入项目标签,然后点击 Github .
  • 如果您尚未授予Gitlab授权访问您的Github帐户,则会提示您立即这样做.
  • 将显示您的Github仓库的列表.对于要导入的每个存储库,请选择名称空间(您自己的名称空间或任何组织的名称空间),并根据需要更改项目名称.(默认是导入到您的个人命名空间,并使用与Github相同的回购名称.)然后单击您要导入的回购旁边的 Import (导入).

导入将需要几分钟.完成后,您将获得整个仓库,包括Wiki,问题和合并请求.发行和合并请求将像Github一样保留票证编号,并且标签似乎也已被迁移.

Github Pages似乎不会自动迁移.这需要一些手动步骤.对于纯静态内容(无SSG),其内容存储在 gh-pages 分支中,过程如下:

  • 切换到您的 gh-pages 分支.
  • 创建一个新文件夹 public 并将所有内容移到那里.
  • 提交更改.
  • 切换回 master 并合并 gh-pages (这样您的内容现在位于 master 中的单独文件夹中,而不是位于其自己的文件夹中分支).
  • 在项目的主页上,单击添加CI/CD .这将创建一个新的 .gitlab-ci.yml 文件;添加以下内容并提交:

 图片:alpine:latest页面:阶段:部署脚本:-回声无所事事..."工件:路径:- 上市只要:- 掌握 

这还需要几分钟.导航到设置>页面,然后单击指向您页面的链接.

Github具有多个用于存储Web内容的选项;上面的内容也可以通过稍作修改而适用于其他人.

Is there a way to move an entire repository from Github to GitLab?

For the code itself, this would be a simple matter of creating a new repo on GitLab and pushing to it.

Wiki pages live in a separate branch on Github and are managed with Git mechanisms; AFAIK the same goes for GitLab. Same story for pages.

That leaves issues and merge requests as the main open points. Is there a way to copy those from Github to GitLab, at least in the state they were in at the time of the migration?

Github offers an export ferature, and GitLab has an import feature which can import a Github repository—do any of these help with the above?

解决方案

GitLab’s import feature has worked quite nicely.

  • On https://gitlab.com (make sure you are logged in), you will get a list of your projects. Click New Project.
  • Open the Import Project tab, and click Github.
  • If you have not granted Gitlab authorization to access your Github account, you will be prompted to do so now.
  • A list of your Github repos will appear. For each repo you wish to import, choose the namespace (your personal one or that of any of your organizations, if any) and change the project name if you wish. (Default is to import to your personal namespace and use the same repo name as on Github.) Then click Import next to the repo you wish to import.

Import will take a couple of minutes. When it finishes, you will get your entire repo, including wiki, issues and merge requests. Issues and merge requests will retain ticket numbers as on Github, and labels also seem to get migrated.

Github Pages do not seem to get migrated automatically. This requires some manual steps. For purely static content (no SSG), with content stored in the gh-pages branch, the process is as follows:

  • Switch to your gh-pages branch.
  • Create a new folder public and move all content there.
  • Commit your changes.
  • Switch back to master and merge gh-pages (so that your content now resides on a separate folder in master rather than its own branch).
  • On your project’s main page, click Add CI/CD. This will create a new .gitlab-ci.yml file; add the following content and commit:

image: alpine:latest

pages:
  stage: deploy
  script:
  - echo 'Nothing to do...'
  artifacts:
    paths:
    - public
  only:
  - master

This will take another few minutes. Navigate to Settings > Pages and click the link to your pages.

Github has multiple options for storing web content; the above may also work for others with slight modifications.

这篇关于将存储库从Github移至Gitlab的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆