当前位置: 首页 > 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.dtcms.com/a/313327.html

相关文章:

  • CCF-GESP 等级考试 2025年6月认证C++一级真题解析
  • 扩散模型(一)——综述
  • 介绍JAVA语言、介绍greenfoot 工具
  • 案例介绍|JSON数据格式的转换|pyecharts模块简介
  • noob靶机复现笔记
  • 纯JavaScript实现文本选择工具栏:功能详解与源码解析
  • RAG 知识库实战指南:基于 Spring AI 构建 AI 知识问答应用
  • Git用法记录
  • UE5的渲染Debug技巧
  • C语言字符串拷贝的三重境界:从下标到指针的华丽变身
  • 设备健康管理标准规范:技术架构与合规性实现指南
  • 《人形机器人的觉醒:技术革命与碳基未来》——类人关节设计:人工肌肉研发进展及一款超生物肌肉Hypermusclet的设计与制造
  • K8S服务发现原理及开发框架的配合
  • k8s黑马教程笔记
  • LeetCode 刷题【29. 两数相除】
  • 波士顿房价预测工具 - XGBoost实现
  • 2.4.1-2.4.3控制范围-控制进度-控制成本
  • C++ 生成动态库.dll 及 C++调用DLL,C++ 生成静态库.lib及 C++调用lib
  • 其它IO函数
  • 在 ArkUI 中实现丝滑嵌套滚动:让你的页面像抖音一样顺滑
  • Redis——运维篇
  • 避不开的数据拷贝
  • 北斗变形监测技术应用与优势
  • 【AI云原生】1、Function Calling:大模型幻觉破解与Agent底层架构全指南(附Go+Python实战代码)》
  • 子区间问题
  • 差分 前缀和
  • 无人机集群协同三维路径规划,采用冠豪猪优化器(Crested Porcupine Optimizer, CPO)实现,Matlab代码
  • 【Django】-8- 视图和模型的关联
  • Linux下Redis常用命令
  • Java线程安全类设计思路总结