在B台服务器部署gitlab环境(版本一致)mysql
在A服务器上打包如下数据并传至B服务器git
cd /home/gitsql
tar zcf repositories.tar.gz repositories数据库
scp repositories.tar.gz git@183.131.1.1:/tmp/服务器
mysqldump -h 127.0.0.1 -u gitlab -p gitlabhq_production> gitlabhq_production0204.sqlssh
scp gitlabhq_production0204.sql git@183.131.1.1:/tmp/ide
B服务器上导入数据并重启gitlab服务:gitlab
cd gitlab
spa
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 (注:清空并不是删除此文件).