1.下载Gitlib
# 安装依赖,并启动ssh、防火墙开启相应端口、postfix
[root@gitlab ~]# yum install -y curl policycoreutils-python openssh-server perl
# 安装完成后会直接启动
[root@gitlab ~]# yum install gitlab-jh-16.0.3-jh.0.el7.x86_64.rpm
初始化的俩种方式
# 以下两种方法都可以配置访问地址,第一种需要在yum安装前配置
[root@gitlab ~]# export EXTERNAL_URL='http://192.168.249.156'
或
[root@gitlab ~]# vim /etc/gitlab/gitlab.rb
external_url 'http://192.168.249.156'
[root@gitlab ~]# gitlab-ctl reconfigure
#查看状态
2.浏览器进入访问
2.1 登录gitlab页面
#输入ip进行访问
#用户名为:root
#密码为:
[root@gitlab ~]# cat /etc/gitlab/initial_root_password
2.2 创建用户组,创建用户
#搜索管理中心,点击左边用户进行创建
2.3邀请用户加入群组
#搜索管理中心 ,点击用户,找到相应的用户点击编辑设置密码
3.切换到设置的管理员账号,然后进行克隆
3.1点击项目然后进入:
3.2到终端进行克隆
#创建了以上用户,分别为前端后端和运维人员
#克隆
[root@gitlab work2]# git clone http://10.36.192.108/guanli/guanli.git
[root@gitlab work2]# ll total 0 drwxr-xr-x 5 root root 63 Nov 21 07:52 guanli [root@gitlab work2]# cd guanli/ [root@gitlab guanli]# ll total 8 -rw-r--r-- 1 root root 6161 Nov 21 07:52 README.md drwxr-xr-x 2 root root 22 Nov 21 07:52 前端 drwxr-xr-x 2 root root 39 Nov 21 07:52 后端 [root@gitlab guanli]# #cd到后端 [root@gitlab guanli]# cd 后端 #创建一个后端分支 [root@gitlab 后端]# git branch houduan #切换到houduan分支 [root@gitlab 后端]# git checkout houduan #编写一个后端文件 [root@gitlab 后端]# echo "最后一次" >> index.php #提交到houduan分支 [root@gitlab 后端]# git add index.php [root@gitlab 后端]# git commit -m "最后一次提交" [houduan 9e6001e] 最后一次提交 1 file changed, 1 insertion(+) [root@gitlab 后端]# git branch * houduan main [root@gitlab 后端]# git push origin houduan Username for 'http://10.36.192.108': houduan // 输入后端人员账号 Password for 'http://houduan@10.36.192.108': //输入 密码 Counting objects: 25, done. Delta compression using up to 2 threads. Compressing objects: 100% (19/19), done. Writing objects: 100% (25/25), 4.56 KiB | 0 bytes/s, done. Total 25 (delta 4), reused 0 (delta 0) remote: remote: To create a merge request for houduan, visit: remote: http://10.36.192.108/guanli/guanli/-/merge_requests/new?merge_request%5Bsource_branch%5D=houduan remote: To http://10.36.192.108/guanli/guanli.git * [new branch] houduan -> houduan
3.3使用houduan用户进入浏览器创建合并
3.4因为上面指派了运维和管理人员,所以使用运维人员登录gitlab
点击进去
点击进入
3.5查看项目是否合并完成 ,使用guanli人员用户密码进入
#显示已经合并成功