当前位置: 首页 > news >正文

GitLab 代码管理平台部署及使用

一、前置条件

1.yum 安装依赖包

yum install -y curl policycoreutils policycoreutils-python-utils openssh-server openssh-clients

2、开启 sshd 和邮件服务

systemctl enable sshd
systemctl start sshdyum install -y postfix
systemctl start postfix
systemctl enable postfix

二、部署 GitLab

本次安装使用:gitlab-ce-17.1.1-ce.0.el7.x86_64.rpm

2.1 下载gitlab-ce 的 rpm 软件包

wget --no-check-certificate https://packages.gitlab.com/gitlab/gitlab-ce/el/7/x86_64/gitlab-ce-17.1.1-ce.0.el7.x86_64.rpm

2.2 rpm 安装 gitlab

rpm -ivh gitlab-ce-17.1.1-ce.0.el7.x86_64.rpm

如下图安装成功
在这里插入图片描述

2.3 修改 GitLab 配置

cp /etc/gitlab/gitlab.rb /etc/gitlab/gitlab.rb.default
vim /etc/gitlab/gitlab.rb

访问地址

#配置用户访问gitlab的访问/下载代码地址
external_url 'http:/192.168.159.129'

邮箱配置

[root@localhost ~]# vim /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'] = "1063410061@qq.com"
#登录邮箱的密码(其他的邮箱为授权码,例如QQ、163邮箱)
gitlab_rails['smtp_password'] = "qiang817."
#修改为对应的邮箱服务器域名
gitlab_rails['smtp_domain'] = "qq.com"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
gitlab_rails['smtp_pool'] = false
#gitlab发送邮件的发送人
gitlab_rails['gitlab_email_from'] = '1063410061@qq.com'

2.4 重载 GitLab 配置

gitlab-ctl reconfigure

启动

gitlab-ctl start

停止

gitlab-ctl stop

重启

gitlab-ctl restart

开机启动

systemctl enable gitlab-runsvdir.service

禁止开机启动

systemctl disable gitlab-runsvdir.service

2.5 访问 GitLab

默认用户:root

密码:需要查看 /etc/gitlab/initial_root_password文件

cat /etc/gitlab/initial_root_password# WARNING: This value is valid only in the following conditions
#          1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails['initial_root_password']` setting in `gitlab.rb`, it was provided before database was seeded for the first time (usually, the first reconfigure run).
#          2. Password hasn't been changed manually, either via UI or via command line.
#
#          If the password shown here doesn't work, you must reset the admin password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.Password: scT2TYkUtjHPX9wS48thq/HRHE1CMmoEyYPTKUcBG/E=# NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.

在这里插入图片描述

三、GitLab 设置中文

如下图所示,点击用户头像,偏好设置中,找到本地化语言
在这里插入图片描述

四、GitLab 基础使用

Groups:对应公司项目,某个项目中可能会有不同数量的服务

projects:对应项目中的某个服务

users:对应公司的开发人员

4.1 GitLab 创建空白项目

在这里插入图片描述
在这里插入图片描述

4.2 创建秘钥

在 window 中任一文件夹中的右键,选择 在终端中打开,运行 ssh-keygen -t rsa 生成一个随机秘钥
在这里插入图片描述

秘钥如上图所示位置,把 id_rsa.pub 文件内容配置到 GitLab 中
在这里插入图片描述

五、GitLab 的基本使用

在GitLab 上创建一个项目
在这里插入图片描述

进入本地项目目录,按如下操作

5.1 初始化 本地Git仓库

git init

5.2 把 Git本地仓库 与远程仓库关联

git remote add origin http://192.168.159.129/ruoyi/crm.git

5.3 把文件加入暂存区

git commit -m "first commit"

5.4 上传代码

 git push -u origin master

5.5 GitLab 上查看是否提交成功

在这里插入图片描述

http://www.lryc.cn/news/608603.html

相关文章:

  • lua中 list.last = last 和list[last]=value区别
  • JavaScript:编程世界中的“语盲”现象
  • 回归的wry
  • 关于vllm【常见问题解决方案】
  • vllm0.8.5:自定义聊天模板qwen_nonthinking.jinja,从根本上避免模型输出<think>标签
  • 【python实用小脚本-169】『Python』所见即所得 Markdown 编辑器:写完即出网页预览——告别“写完→保存→刷新”三连
  • k8s+isulad 国产化技术栈云原生技术栈搭建1-VPC
  • OSPF HCIP
  • Starrocks ShortCircuit短路径的调度
  • 华为云云服务高级顾问叶正晖:华为对多模态大模型的思考与实践
  • 基于云模型的模糊综合风险评估Matlab代码
  • Matlab 高斯牛顿法拟合曲线
  • K8S部署ELK(四):部署logstash
  • MATLAB小波分析工具包进行时间序列的小波功率谱分析
  • 后端研发转型爬虫实战:Scrapy 二开爬虫框架的避坑指南
  • 量子物理学的前沿意义虚无、形式混乱
  • 0803 思维导图+小项目
  • Python爬虫实战:研究awesome-python工具,构建技术资源采集系统
  • uniapp 跨端开发
  • 机器学习——下采样(UnderSampling),解决类别不平衡问题,案例:逻辑回归 信用卡欺诈检测
  • 什么是shebang
  • Java基础:代码块/内部类/Lambda函数/常用API/GUI编程
  • JavaEE初阶第十三期:解锁多线程,从 “单车道” 到 “高速公路” 的编程升级(十一)
  • 自动驾驶中的传感器技术20——Camera(11)
  • 【MATLAB】(六)多项式的创建与四则运算
  • TCP-单线程版本
  • pytorch 安装
  • 2025年渗透测试面试题总结-2025年HW(护网面试) 76-1(题目+回答)
  • cmd怎么取消关机命令
  • 麦肯锡咨询公司PEI经典面试题目汇总