gitlab 实战

一.安装依赖

复制代码
yum install -y curl policycoreutils-python openssh-server perl

二.安装gitlab

复制代码
yum install gitlab-jh-16.0.3-jh.0.el7.x86_64.rpm

三.修改下面的

复制代码
vim /etc/gitlab/gitlab.rb

external_url 'http://192.168.249.156'

四.初始化

复制代码
gitlab-ctl reconfigure

五.查看状态

复制代码
 gitlab-ctl status

六.登陆 Gitlab

  1. 开始都是root用户登录,密码在/etc/gitlab/initial_root_password
  2. 修改密码
  3. 添加用户组
  4. 添加用户(管理员,开发者,维护者,普通用户登录的)
  5. 切换用户到管理员
  6. 添加项目
  7. 邀请用户到用户组
  8. 在项目里测试,添加前端( xiaoshuai)和后端(xiaobai)的目录

9.在终端里使用useradd xiaoshuai ,创建一个用户用来拉取代码进行测试,用 ssh-keygen 生成xiaoshuai用户的密钥,把这个密钥添加在管理员用户的gitlab的ssh密钥中,然后拉取代码。

10.配置

root@gitlab \~# git config --global user.name "xiaoshuai" #配置git使用用户

root@gitlab \~# git config --global user.email "xiaoshuai@aliyun.com" #配置git使用邮箱

root@gitlab \~# git config --global color.ui true #语法高亮

  1. 开发者小帅用户操作

    [xiaoshuai@web2 ~]$ ls

    clound

    [xiaoshuai@web2 ~]$ cd clound

    [xiaoshuai@web2 clound]$ ls

    README.md 后端 前端

    [xiaoshuai@web2 clound]$ cd 前端/

    [xiaoshuai@web2 前端]$ ls

    [xiaoshuai@web2 前端]$ echo "你最帅 小帅前端测试" >> index.html

    [xiaoshuai@web2 前端]$ ls

    index.html

    [xiaoshuai@web2 前端]$ git add .

    [xiaoshuai@web2 前端]$ git commit -a -m "第一次提交前端测试"

    [main ca87aa2] 第一次提交前端测试

    1 file changed, 1 insertion(+)

    create mode 100644 "\345\211\215\347\253\257/index.html"

    [xiaoshuai@web2 前端]$ git checkout -b xiaoshuai

    切换到一个新分支 'xiaoshuai'

    [xiaoshuai@web2 前端]$ git branch

    main

    origin

    • xiaoshuai

12.提交代码到gitlab 分支小帅

13.开发者小帅用户查看

相关推荐
极小狐3 小时前
极狐GitLab Runner 自托管安全加固指南
安全·ci/cd·gitlab·devops·runner·安全加固
钝挫力PROGRAMER1 天前
Windows Docker 环境搭建 GitLab CI/CD 流水线
windows·docker·gitlab·gitlab-runner
我一定会有钱7 天前
打造完美工作流:Git 配置”一次推送,三端同步”(Gitee/GitCode/GitHub)
开发语言·windows·vscode·搜索引擎·gitlab·github·visual studio code
LXY_BUAA7 天前
Git_在飞牛中部署 GitLab_20260817
git·gitlab
Jeanyia10 天前
GitLab 配套 Git 常用命令
git·gitlab
极小狐10 天前
极狐GitLab 补丁版本:19.2.1、19.1.3、19.0.5
网络·安全·gitlab·极狐gitlab·安全更新·补丁版本
rustfs11 天前
GitLab 如何与 RustFS 集成?
分布式·rust·gitlab
郝亚军13 天前
gitlab常用命令
gitlab
xixingzhe216 天前
Java 使用 GitLab4J 实现 WebHook
gitlab
童槿顏丶18 天前
GitLab部署到Linux
linux·运维·gitlab