linux安装gitlab&&idea推送代码至gitlab

gitlab介绍

GitLab 是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,并在此基础上搭建起来的web服务

image-20201228104305796

安装(Centos7)

安装相关依赖

yum -y install policycoreutils openssh-server openssh-clients postfix policycoreutils-python

启动ssh服务,设置为开启启动

systemctl enable sshd && sudo systemctl start sshd

设置ssh以及http服务,并启动,postfix支持gitlab发信功能

systemctl enable postfix && systemctl start postfix

开放ssh以及http服务,然后重新加载防火墙

firewall-cmd --add-service=ssh --permanent
firewall-cmd --add-service=http --permanent
firewall-cmd --reload

如果关闭防火墙就不需要做以上配置

下载gitlab包,并安装

yum install -y wget
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-12.9.9-ce.0.el7.x86_64.rpm
rpm  -ivh gitlab-ce-12.9.9-ce.0.el7.x86_64.rpm

image-20201228110820401

看到图标后,说明安装成功

上图提示我们可以修改/etc/gitlab/gitlab.rb配置文件

1.修改nginx默认监听端口为82

image-20201228111337080

2.配置外部访问url为 http://192.168.1.50:82

image-20201228111438250

重载配置及启动gitlab

reconfigure的时间比较长,需要几分钟时间,等待一下。

gitlab-ctl reconfigure
gitlab-ctl restart

端口添加到防火墙

firewall-cmd --zone=public --add-port=82/tcp --permanent
firewall-cmd --reload

登陆界面:192.168.1.50:82(如果出现502页面,说明gitlab没有完全启动,需要等待一会)

image-20201228112416803

修改密码后,用root账号登陆,进入首页,至此gitlab安装完毕。

image-20201228112625118

基本使用

创建组

image-20201228130420491

创建项目

image-20201228130502699

创建用户:

image-20201228130656350

image-20201228130725158

image-20201228130838028

用户添加密码:

image-20201228130931898

给group分配用户和权限

image-20201228131124819

五种权限:

  • Guest:可以创建issue,发表评论,不能读写版本库
  • reporter:可以克隆代码,不能提交
  • developer:可以克隆代码,开发,提交,push
  • maintainer:可以创建项目,添加tag,保护分支,添加项目成员,编辑项目
  • owner:可以设置项目访问权限,删除项目,迁移项目,管理组成员

上传代码至gitlab

首先创建一个普通的boot的web项目

image-20201228132323047

选择git,点击ok

image-20201228132350053

点击add

image-20201228132433372

点击commit directory

image-20201228132502330

点击commit

image-20201228132536119

添加远程仓库

image-20201228132648934

复制出gitlab远程地址

image-20201228132920126

填入远程地址,点击ok

image-20201228132951364

第一次进入,需要填入账号密码

image-20201228133037001

push代码到远程gitlab仓库

image-20201228133125326

image-20201228133146517

刷新gitlab,发现我们的代码推送到gitlab中了

image-20201228133247079

原文地址:https://www.cnblogs.com/wwjj4811/p/14200721.html