Git - 记一次完整的新旧Gitlab迁移

简介: Git - 记一次完整的新旧Gitlab迁移

要求

  • 保留完整的分支
  • 保留提交记录


群组迁移

两种方式, 如果多就迁移,如果少,就新建。

原GitLab_群组导出


新GitLab_群组导入


Project迁移(UI方式)

原GitLab_项目导出

选择 【下载导出】

新GitLab_项目导入


Project迁移(command方式)【推荐】

核心

#从老gitlib拉取裸仓库,并在本地文件系统创建gitbook-demo.git文件夹
git clone --bare ssh://git@oldgitlab:port/group1/gitproject-demo.git
#进入代码目录
cd gitproject-demo.git
#向新git推送镜像
git push --mirror ssh://git@newgitlab:port/group1/gitproject-demo.git
  • --bare是裸仓库的意思,区别与git clone,他不是一个工作空间,不可以在目录下进行变更操作,即使操作了也不被接受, 执行命令后会复制全部的分支、标签,并且在命令执行过程中的所有远端的变动均被忽略。

–bare

Make a bare Git repository. That is, instead of creating and placing the administrative files in /.git, make the itself the $GIT_DIR. This obviously implies the --no-checkout because there is nowhere to check out the working tree. Also the branch heads at the remote are copied directly to corresponding local branch heads, without mapping them torefs/remotes/origin/. When this option is used, neither remote-tracking branches nor the related configuration variables are created.

  • --mirror镜像代码仓库,完完整整

Instead of naming each ref to push, specifies that all refs under refs/ (which includes but is not

limited to refs/heads/, refs/remotes/, and refs/tags/) be mirrored to the remote repository.

Newly created local refs will be pushed to the remote end, locally updated refs will be force

updated on the remote end, and deleted refs will be removed from the remote end. This is the

default if the configuration option remote..mirror is set.


原Gitlab Clone bare

ysw@DESKTOP-T7NDJ0A MINGW64 /d/codeMerge
$ git clone --bare  http://ip:port/xxxx/yyy.git
Cloning into bare repository 'uomSM.git'...
remote: Enumerating objects: 1438, done.
remote: Total 1438 (delta 0), reused 0 (delta 0), pack-reused 1438
Receiving objects: 100% (1438/1438), 872.14 MiB | 32.58 MiB/s, done.
Resolving deltas: 100% (420/420), done.
ysw@DESKTOP-T7NDJ0A MINGW64 /d/codeMerge

新的Gitlab创建新子群组(可选)

按需选择


推送bare版本到新Gitlab

```java
ysw@DESKTOP-T7NDJ0A MINGW64 /d/codeMerge
$ pwd
/d/codeMerge
ysw@DESKTOP-T7NDJ0A MINGW64 /d/codeMerge
$ cd uomSM.git/
- uom子群组名
- yyy自定义项目名称,我一般保持和旧的项目一致
$ git push --mirror https://新git地址/xxxx/uom/yyy.git

查看新Gitlab中的工程

OK,分支正常,提交日志正常。

设置个人访问令牌

记住该令牌

IDEA Clone Project

git clone https://xxxx/xx/xxx/xxxxx.git

输入 账号和个人访问令牌

常见问题

SSL certificate problem: self signed certificate in certificate chain

执行 git config --global http.sslverify false


remote: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password. See

请按照 《设置个人访问令牌》章节设置密码,并保存该密码,使用该密码访问Gitlab


相关文章
|
5月前
gitlab迁移后报错OpenL::cipher::CipherError
gitlab迁移后报错OpenL::cipher::CipherError
181 0
|
2月前
|
Linux 网络安全 开发工具
码农日常生活之Git & Gitlab & Gitk
本文是关于Git和GitLab的配置使用教程,包括基础设置、日常命令操作以及图形工具的使用。
41 2
|
4月前
|
运维 Java Devops
阿里云云效操作报错合集之在进行GitLab代码分支迁移时遇到报错,一般是什么原因
本合集将整理呈现用户在使用过程中遇到的报错及其对应的解决办法,包括但不限于账户权限设置错误、项目配置不正确、代码提交冲突、构建任务执行失败、测试环境异常、需求流转阻塞等问题。阿里云云效是一站式企业级研发协同和DevOps平台,为企业提供从需求规划、开发、测试、发布到运维、运营的全流程端到端服务和工具支撑,致力于提升企业的研发效能和创新能力。
|
5月前
|
jenkins 持续交付 开发工具
【gitlab】旧的gitlab项目迁移新的gitlab
【gitlab】旧的gitlab项目迁移新的gitlab
562 0
|
2月前
|
开发工具 git
[git]记配置本地git到gitlab并推送
[git]记配置本地git到gitlab并推送
|
2月前
|
Linux 开发工具 git
[git]基于GitLab搭建本地Git服务
[git]基于GitLab搭建本地Git服务
|
4月前
|
持续交付 开发工具 git
阿里云云效产品使用问题之在云效代码域中gitlab使用docker安装的,迁移时遇到“获取企业信息失败”,是什么原因
云效作为一款全面覆盖研发全生命周期管理的云端效能平台,致力于帮助企业实现高效协同、敏捷研发和持续交付。本合集收集整理了用户在使用云效过程中遇到的常见问题,问题涉及项目创建与管理、需求规划与迭代、代码托管与版本控制、自动化测试、持续集成与发布等方面。
|
4月前
|
开发工具 git
git项目迁移
git项目迁移
27 2
|
4月前
|
开发工具 git
idea中git替换,推送到新的github或者gitlab上面
idea中git替换,推送到新的github或者gitlab上面
315 2
|
5月前
|
安全 Shell 网络安全
Git学习---Git快速入门、Git基础使用、Git进阶使用、Git服务器使用(IDEA集成GitHub、Gitee、GitLab)、GitHub Desktop客户端
Git学习---Git快速入门、Git基础使用、Git进阶使用、Git服务器使用(IDEA集成GitHub、Gitee、GitLab)、GitHub Desktop客户端
183 0
下一篇
无影云桌面