【Gitlab】安装和配置
安装
yum -y install curl policycoreutils openssh-server openssh-clients postfix
vim /etc/postfix/main.cf
inet_interfaces = all
- 启动postfix邮件服务(用于gitlab发送通知到管理者)
systemctl start postfix && systemctl enable postfix
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
yum install -y gitlab-ce

配置
vim /etc/gitlab/gitlab.rb
external_url 'http://192.168.247.132'
gitlab-ctl reconfigure
gitlab-ctl restart
systemctl enable gitlab-runsvdir.service
- 重新编译配置
gitlab-ctl reconfigure
- 查看状态
gitlab-ctl status
- 修改配置
vim /etc/gitlab/gitlab.rb
- 检查gitlab
gitlab-rake gitlab:check SANITIZE=true --trace
- 查看日志
gitlab-ctl tail
gitlab-ctl tail nginx/gitlab_access.log
备份和还原
常见操作
代码回滚到特定版本
- 用命令行打开git项目路径,输入git log命令查看commit记录
git log
commit c085b6a01d0521177ea0b80262a9caff9c021e34
Author: wuxingle <1546752823@qq.com>
Date: Thu Feb 25 08:45:03 2021 +0800
恢复网商和平安真实余额查询
commit a2476e8a41a289200d1f083218fc2a8c8b66c708
Author: wuxingle <1546752823@qq.com>
Date: Wed Feb 24 15:42:14 2021 +0800
修改批次查询时排序
commit 0df4afbd99bc3fde8e519cd8aad517e0a2b6d3d1
Author: daijiong <daijiong@successhr.com>
Date: Wed Feb 24 15:04:50 2021 +0800
- 找到需要回滚的commit,输入
git reset --hard {commitId}
,将本地文件回滚
git reset --hard c085b6a01d0521177ea0b80262a9caff9c021e34
HEAD is now at c085b6a0 恢复网商和平安真实余额查询
- 此时本地文件已经回滚到刚刚commit c085b6a01d0521177ea0b80262a9caff9c021e34之后的状态,但是服务器仍然没有改变,需要继续远程回滚
git push -f
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
remote:
remote: To create a merge request for hotfix_20210222_bugfix, visit:
remote: http://gitlab.ukerw.com/ukerw/uker-psp/-/merge_requests/new?merge_request%5Bsource_branch%5D=hotfix_20210222_bugfix
remote:
To http://gitlab.ukerw.com/ukerw/uker-psp.git
+ 75ba6387...c085b6a0 hotfix_20210222_bugfix -> hotfix_20210222_bugfix (forced update)
评论区