发布时间:2020-08-17 14:13:43编辑:admin阅读(3757)
操作系统:centos 6.9 版本:GitLab 社区版 10.5.1 安装方式:yum
操作系统:centos 7.6 版本:GitLab Community Edition 13.2.0 安装方式:docker
现在需要将部分老的gitlab项目,迁移到新gitlab中。
由于版本跨度比较大,不能直接将原gitlab项目备份导出,然后在新gitlab中导入。
注意:只能使用git命令行进行迁移
以springbootdemo项目为例:
原gitlab地址:http://gitlab.baidu.com/java/springbootdemo.git 新gitlab地址:http://gitlab.aliyun.com/java/springbootdemo.git注意:新gitlab需要手动创建项目springbootdemo
执行以下命令:
# 拉取远程所有分支 git clone --mirror http://gitlab.baidu.com/java/springbootdemo.git cd springbootdemo.git/ git config --bool core.bare false # 切换remote_url git remote set-url origin http://gitlab.aliyun.com/java/springbootdemo.git # 推送所有分支 git push --mirror origin
注意:http方式下载项目,会提示输入用户名和密码。使用ssh方式就不需要了。
需要将本机的公钥写入到新gitlab中的git用户中的authorized_keys
说明:
简单使用git clone ,git fetch —all, git pull —all 都不能全部一次获取远程的所有分支,他们都只对master分支起作用,所以一次性拉取所有远程分支到本地应该使用 git clone的—mirror参数,但是这样会把它初始化为一个bare仓库,所以需要去掉这个属性
本文参考链接:
http://www.manongjc.com/article/34449.html
上一篇: 基于docker搭建gitlab
下一篇: 基于docker搭建jenkins
51551
51114
41648
38403
32890
29869
28583
23538
23471
21821
1967°
2669°
2222°
2158°
2606°
2187°
2916°
4841°
4683°
3326°