1. 创建账户初始密码
gitlab-rails consoleu=User.find(1) ## 自己创建的账户可以find(2) 也可以查找邮箱 User.find_by_email("***@qq.com")u.password='12345678'u.save
2. 备份与恢复
2.1备份
gitlab-rake gitlab:backup:create
/etc/gitlab/gitlab.rb 配置文件须备份
/var/opt/gitlab/nginx/conf nginx配置文件
/etc/postfix/main.cfpostfix 邮件配置备份
## 可通过/etc/gitlab/gitlab.rb配置文件来修改默认存放备份文件的目录
vim /etc/gitlab/gitlab.rb
gitlab_rails['backup_path'] = "/var/opt/gitlab/backups"
gitlab-ctl reconfigure
gitlab_rails['backup_keep_time'] = 604800 ## 备份保存的时间
2.2 恢复
注意:恢复的版本需相同
将备份文件权限修改为777,不然可能恢复的时候会出现权限不够,不能解压的问题
chmod 777 ***.tar执行命令停止相关数据连接服务
gitlab-ctl stop unicorn gitlab-ctl stop sidekiq执行命令从备份文件中恢复Gitlab ```shell gitlab-rake gitlab:backup:restore BACKUP=编号
敲完命令后,出现第一个交互页面 输入 yes
第二个交互页面 yes
4. 启动Gitlab
```shell
gitlab-ctl start
3. 首次使用gitlab
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git clone git@node1:root/test.git ## 克隆
git commit -m "add index.html" ## 添加
git push ## 推送
3.1 修改配置文件,让它使用IP进行访问
vim /etc/gitlab/gitlab.rb
external_url 'http://X.X.X.X'
gitlab-ctl reconfigure ## 重新加载配置文件,稍微有点慢
3.2 常用命令
gitlab-ctl stop #关闭gitlab
gitlab-ctl start #启动gitlab
gitlab-ctl restart #重启gitlab
gitlab-ctl reconfigure #重载配置文件
gitlab-ctl status #查看gitlab组件状态
