当前位置: 首页 > 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.xdnf.cn/news/1235071.html

相关文章:

  • Java基本技术讲解
  • PPT自动化 python-pptx - 9: 图表(chart)
  • 决策树学习全解析:从理论到实战
  • 【LeetCode刷题指南】--二叉树的后序遍历,二叉树遍历
  • PPT写作五个境界--仅供学习交流使用
  • 【1】WPF界面开发入门—— 图书馆程序:登录界面设计
  • 业务系统跳转Nacos免登录方案实践
  • web前端React和Vue框架与库安全实践
  • 【设计模式】4.装饰器模式
  • ThinkPHP5x,struts2等框架靶场复现
  • LLM - 智能体工作流设计模式
  • 【嵌入式硬件实例】-555定时器IC的负电压发生器
  • 设计原则和设计模式
  • 【C++ 初级工程师面试--4】形参带默认值的函数,特点,效率,注意事项
  • 秋招笔记-8.3
  • PHP面向对象编程与数据库操作完全指南-下
  • C语言数据结构(7)贪吃蛇项目2.贪吃蛇项目实现
  • 云轴科技ZStack AI翻译平台建设实践-聚焦中英
  • React中的Hooks
  • JavaEE初阶第十三期:解锁多线程,从 “单车道” 到 “高速公路” 的编程升级(十一)
  • 设计模式 - 组合模式:用树形结构处理对象之间的复杂关系
  • uniapp 跨端开发
  • 8.3 滑窗 |栈|阶乘判断
  • 什么是列存储(Columnar Storage)?深度解析其原理与应用场景
  • 【领域热点】【Vue】Vue 与 WebAssembly:前端性能优化的黄金搭档
  • [创业之路-535]:软件需要原型验证、产品需要原型验证、商业模式也需要原型验证
  • 实战解析:编程式事务在实际开发中的典型应用场景
  • Linux系统编程Day4-- Linux常用工具(yum与vim)
  • vulhub-corrosion2靶机
  • 1.8 axios详解