#下载gitlab
https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/gitlab-ce-10.1.3-ce.0.el6.x86_64.rpm
sudo yum install -y curl policycoreutils-python openssh-server cronie
sudo lokkit -s http -s ssh
sudo yum install postfix
sudo service postfix start
sudo chkconfig postfix on
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash
yum install gitlab-ce-10.1.3-ce.0.el6.x86_64.rpm
#修改配置,添加下面内容
vi /etc/gitlab/gitlab.rb
#域名修改
external_url 'http://newcode.topv.com'
#时区修改
gitlab_rails['time_zone'] = 'Asia/Shanghai'
#修改ssh默认端口
gitlab_rails['gitlab_shell_ssh_port'] = 22222
#存储路径修改
git_data_dir "/data/gitlab"
#备份路径设置
gitlab_rails['manage_backup_path'] = true

#备份周期设置604800=7天
gitlab_rails['backup_keep_time'] = 604800
#修改访问端口
nginx['listen_port'] = 9394

#添加白名单

gitlab_rails['rack_attack_git_basic_auth'] = {
   'enabled' => true,
   'ip_whitelist' => ["127.0.0.1","Gitlab部署的IP地址"],
 }

 

##############################################################################
#恢复
sudo mv /etc/gitlab /etc/gitlab.$(date +%s)
# 将下面配置备份文件的时间戳改为你所备份的文件的时间戳
sudo tar -xf etc-gitlab-1399948539.tar -C /
# 将数据备份文件拷贝至备份目录
sudo cp 1393513186_gitlab_backup.tar /data/gitlab/backups
# 停止连接数据库的进程
sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop sidekiq
# 恢复1393513186这个备份文件,将覆盖GitLab数据库!
sudo gitlab-rake gitlab:backup:restore BACKUP=1393513186
# 启动 GitLab
sudo gitlab-ctl start
# 检查 GitLab
sudo gitlab-rake gitlab:check SANITIZE=true
##############################################################################
#故障排查
#502
#重启服务后502
#执行
gitlab-rake gitlab:import:repos
#访问页面过程中502,执行下面查看log
gitlab-ctl tail
#修复丢失文件
#https://www.ipreferjim.com/2012/02/git-push-fatal-unable-to-read-sha1/
#https://lists.nongnu.org/archive/html/dolibarr-dev/2012-10/txtyMlY1ONYxU.txt
    #备份过程中出现error: Could not read,上传文件
    #进入该git的目录执行
    git fsck --full
    git ls-tree cd5aa220b358f2839f083b0fea5684483875aff2
    #所有版本
    git rev-list HEAD
    #查看日志历史
    git log --raw --all --full-history
    #查看文件内容
    git cat-file -p 196035e8754a0c3d3966f0bc9619f66f5c1b94ba
    #上传丢失的文件,sha-1码要一致
    git hash-object -w 196035e8754a0c3d3966f0bc9619f66f5c1b94ba

#有些损坏的并且无法找回的可以删除掉


相关文章:

  • 2021-06-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-01
  • 2023-02-08
猜你喜欢
  • 2021-09-29
  • 2022-12-23
  • 2021-06-18
  • 2021-11-21
  • 2022-12-23
  • 2021-06-30
  • 2021-12-30
相关资源
相似解决方案