gitlab和gitlab項目遷移


一、概述

原gitlab

操作系統:centos 6.9
版本:GitLab 社區版 10.5.1
安裝方式:yum

 

新gitlab

操作系統: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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM