操作系统: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仓库,所以需要去掉这个属性
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有