1)、GitLab是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,并在此基础上搭建起来的web服务。基础功能免费,高级功能收费
2)、为什么要使用GitLab
1)、关闭防火墙
启动: systemctl start firewalld
关闭: systemctl stop firewalld
查看状态: systemctl status firewalld
开机禁用 : systemctl disable firewalld
开机启用 : systemctl enable firewalld
2)、添加GitLab仓库,并安装
[root@localhost ~]# curl -sS http://packages.gitlab.cc/install/gitlab-ce/script.rpm.sh | sudo bash
[root@localhost ~]# yum install gitlab-ce -y
3)、启动GitLab
[root@localhost ~]# gitlab-ctl reconfigure
4)、修改配置信息
[root@localhost ~]# vi /etc/gitlab/gitlab.rb
修改如下两处配置:
external_url 'http://192.168.126.160:8888/'
nginx['listen_port'] = 8888
5)、重新配置GitLab
[root@localhost ~]# gitlab-ctl reconfigure
6)、修改root用户的密码,并使用root用户登录
1)、查看GitLab状态
[root@localhost ~]# gitlab-ctl status
2)、GitLab启动
[root@localhost ~]# gitlab-ctl start
3)、GitLab停止
[root@localhost ~]# gitlab-ctl stop
4)、GitLab重启
[root@localhost ~]# gitlab-ctl restart
5)、查看日志
GitLab默认的日志文件放在/var/log/gitlab目录下
查看所用日志:
[root@localhost ~]# gitlab-ctl tail
1)、配置邮箱服务的用途
2)、配置步骤
1)开启QQ邮箱的smtp服务并获取授权码
2)修改GitLab配置
[root@localhost ~]# vi /etc/gitlab/gitlab.rb
修改如下配置:
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp.qq.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = "[email protected]"
gitlab_rails['smtp_password'] = "开启QQ邮箱的smtp服务时获取的授权码"
gitlab_rails['smtp_domain'] = "qq.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
user['git_user_email'] = "[email protected]"
gitlab_rails['gitlab_email_from'] = '[email protected]'
3)重新配置GitLab
[root@localhost ~]# gitlab-ctl reconfigure
4)测试邮件服务是否正常
[root@localhost ~]# gitlab-rails console
Notify.test_email(‘接收方邮件地址’,‘邮件标题’,‘邮件内容’).deliver_now
1)、为什么要保护分支
保护特定的分支不被随便合并,以免影响相应的分支