1)、GitLab是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,并在此基础上搭建起来的web服务。基础功能免费,高级功能收费
2)、为什么要使用GitLab
基础功能开源,可自行搭建可以进行权限控制,使得代码对部分人可见GitLab使用方便,非常适合企业内部使用 二、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 -y3)、启动GitLab
[root@localhost ~]# gitlab-ctl reconfigure4)、修改配置信息
[root@localhost ~]# vi /etc/gitlab/gitlab.rb修改如下两处配置:
external_url 'http://192.168.126.160:8888/'nginx['listen_port'] = 88885)、重新配置GitLab
[root@localhost ~]# gitlab-ctl reconfigure6)、修改root用户的密码,并使用root用户登录
三、GitLab常用命令1)、查看GitLab状态
[root@localhost ~]# gitlab-ctl status2)、GitLab启动
[root@localhost ~]# gitlab-ctl start3)、GitLab停止
[root@localhost ~]# gitlab-ctl stop4)、GitLab重启
[root@localhost ~]# gitlab-ctl restart5)、查看日志
GitLab默认的日志文件放在/var/log/gitlab目录下
查看所用日志:
[root@localhost ~]# gitlab-ctl tail 四、配置GitLab邮件服务1)、配置邮箱服务的用途
有合并请求时,邮件通知账号注册时,邮件验证修改密码时,通过邮件修改2)、配置步骤
1)开启QQ邮箱的smtp服务并获取授权码
2)修改GitLab配置
[root@localhost ~]# vi /etc/gitlab/gitlab.rb修改如下配置:
gitlab_rails['smtp_enable'] = truegitlab_rails['smtp_address'] = "smtp.qq.com"gitlab_rails['smtp_port'] = 465gitlab_rails['smtp_user_name'] = "xxx@qq.com"gitlab_rails['smtp_password'] = "开启QQ邮箱的smtp服务时获取的授权码"gitlab_rails['smtp_domain'] = "qq.com"gitlab_rails['smtp_authentication'] = "login"gitlab_rails['smtp_enable_starttls_auto'] = truegitlab_rails['smtp_tls'] = trueuser['git_user_email'] = "xxx@qq.com"gitlab_rails['gitlab_email_from'] = 'xxx@qq.com'3)重新配置GitLab
[root@localhost ~]# gitlab-ctl reconfigure4)测试邮件服务是否正常
[root@localhost ~]# gitlab-rails consoleNotify.test_email(‘接收方邮件地址’,‘邮件标题’,‘邮件内容’).deliver_now
五、GitLab的账号注册及分组1)、开启注册邮箱验证
2)、创建组
组的访问级别:
3)、添加组员
组员角色:
4)、在组中创建项目
1)、为什么要保护分支
保护特定的分支不被随便合并,以免影响相应的分支
2)、保护分支
能push就能merge,master分支设置只能Maintainer可以合并