Gitlab遷移

在B臺服務器部署gitlab環境(版本一致)


在A服務器上打包以下數據並傳至B服務器

cd /home/git

tar zcf repositories.tar.gz repositories

scp repositories.tar.gz [email protected]:/tmp/

mysqldump -h 127.0.0.1 -u gitlab -p gitlabhq_production> gitlabhq_production0204.sql

scp gitlabhq_production0204.sql [email protected].1:/tmp/


B服務器上導入數據並重啓gitlab服務:

cd gitlab

1. 將傳入過來的repositories庫下所有內容除了(root目錄)拷貝到本機repositories庫目錄下

檢查或修改文件權限:

sudo chmod -R ug+rwX,o-rwx /home/git/repositories/

chmod -R ug-s repositories

find /home/git/repositories/ -type d -print0 | sudo xargs -0 chmod g+s

2. 導入keys

替換傳過來的authorized_keys文件,注意文件權限600

3. 導入數據庫

mysql -h 127.0.0.1 -u gitlab -p gitlabhq_production </tmp/gitlabhq_production0204.sql

4. 生成並檢測庫

sudo -u git -H bundle exec rake gitlab:import:repos RAILS_ENV=production

sudo -u git -H bundle exec rake gitlab:satellites:create RAILS_ENV=production

sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production

5. 重啓gitlab服務.



git服務器遷移成功後,客戶端作以下更改即可:

1. 更改hosts指向至新的IP地址。

2. 清空本地帳號下密鑰文件中原先的git連接記錄:

     以我的地址爲例 C:\Users\bunny\.ssh\known_hosts  (注:清空並非刪除此文件).


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章