lujiguo115 发表于 2018-9-19 10:17:07

gitlab完整迁移

  环境介绍:
  CentOS 6.7
  gitlab:6.3.1
  需求:gitlab从A服务器迁移至B服务器
  第一、在B服务器上部署gitlab环境
  参考《GitLab完整搭建(版本6.3.1)》
  第二、备份A服务器上的数据
  1).打包仓库文件
#su- git  
$cd/home/git/
  
$tarzcvf repositories.tar.gz ./repositories
  2).备份sql文件
$mysqldump-uroot -pxxxx gitlabhq_production > /tmp/gitlabhq_production.sql  3).备份keys
$cp/home/git/.ssh/authorized_keys /tmp/authorized_keys  4).复制1-3步的文件到B服务器
$scprepositories.tar.gz gitlabhq_production.sql authorized_keys root@B:/tmp/  第三、在B服务器上导入数据
  1). 导入仓库,检查权限
$cd/home/git  
$tarzxvf repositories.tar.gz
  如果权限有异常,直接重新赋权
$chown-R git.git /home/git/repositories/  2).导入数据库
$mysql-uroot -pxxx gitlabhq_production < gitlabhq_production.sql  3).导入keys
$catauthorized_keys >> /home/git/.ssh/authorized_keys  4.将文件导入ruby
$cd/home/git/gitlab/  
$bundleexec rake gitlab:import:repos RAILS_ENV=production
  
$bundleexec rake gitlab:satellites:create RAILS_ENV=production
  5).检测
$bundleexec rake gitlab:check RAILS_ENV=production  如果检测没有异常,可以重启gitlab服务
#/etc/init.d/gitlab restart  第四、验证git pull/push与异常解决
  1). git pull

  2). git push

  如果报错:
  git.exe push --progress "origin"master:master
  Counting objects: 3, done.
  Delta compression using up to 4 threads.
  Compressing objects: 100% (2/2), done.
  Writing objects: 100% (3/3), 350 bytes | 0bytes/s, done.
  Total 3 (delta 0), reused 0 (delta 0)
  remote: GitLab: An unexpected erroroccurred (redis-cli returned 1).
  remote: error: hook declined to updaterefs/heads/master
  To http://192.168.4.251/caoyang/test1121.git
  ! master -> master(hook declined)
  error: failed to push some refs to'http://192.168.4.251/caoyang/test1121.git'
  屏蔽 /home/git/gitlab-shell/config.yml 28行redis配置



页: [1]
查看完整版本: gitlab完整迁移