linux系统gitlab的安装与使用

安装gitlab和使用

安装配置gitlab

安装

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

上传rpm包

yum install gitlab-jh-16.0.3-jh.0.el7.x86_64.rpm

初始化

ini 复制代码
# 以下两种方法都可以配置访问地址,第一种需要在yum安装前配置
#第一种
export EXTERNAL_URL='http://192.168.249.156'

#第二种
vim /etc/gitlab/gitlab.rb
external_url 'http://192.168.249.156'


gitlab-ctl reconfigure     //启动

使用浏览器访问

复制代码
用户名:root
密码:cat /etc/gitlab/initial_root_password    //查看密码

gitlab的使用

命令行修改密码

复制代码
gitlab-rails console -e production

irb(main):001:0> user = User.where(id: 1).first     # id为1的是超级管理员

irb(main):002:0> user.password = 'yourpassword'      # 密码必须至少8个字符

irb(main):003:0> user.save!                          # 如没有问题 返回true

exit 												 # 退出

gitlab服务管理

复制代码
gitlab-ctl start                        # 启动所有 gitlab 组件
gitlab-ctl stop                         # 停止所有 gitlab 组件
gitlab-ctl restart                      # 重启所有 gitlab 组件
gitlab-ctl status                       # 查看服务状态
gitlab-ctl reconfigure                  # 启动服务
gitlab-ctl tail                         # 查看日志

vim /etc/gitlab/gitlab.rb               # 修改默认的配置文件

项目操作

复制代码
创建项目,拉取项目代码
vim 项目文件/.git/config  更改下拉和上传文件的格式
[remote "origin"]
        url = http://192.168.188.176/ximu/test.git    #决定上传下载格式是使用ssh还是http
        fetch = +refs/heads/*:refs/remotes/origin/*


更改分支,编写代码,提交代码

可以在浏览器合并分支
相关推荐
人工智能训练43 分钟前
【极速部署】Ubuntu24.04+CUDA13.0 玩转 VLLM 0.15.0:预编译 Wheel 包 GPU 版安装全攻略
运维·前端·人工智能·python·ai编程·cuda·vllm
微露清风2 小时前
系统性学习Linux-第二讲-基础开发工具
linux·运维·学习
不会代码的小猴3 小时前
Linux环境编程第六天笔记--system-V IPC
linux·笔记
阳光九叶草LXGZXJ3 小时前
达梦数据库-学习-48-DmDrs控制台命令(同步之Manager、CPT模块)
linux·运维·数据库·sql·学习
诸神缄默不语3 小时前
Linux命令行教程
linux
小二李4 小时前
第11章 nestjs服务端开发:登录鉴权
运维·服务器
i建模5 小时前
如何在Arch Linux中重设忘记的root密码
linux·运维·服务器
chatexcel6 小时前
元空AI+Clawdbot:7×24 AI办公智能体新形态详解(长期上下文/自动化任务/工具粘合)
运维·人工智能·自动化
kida_yuan6 小时前
【Linux】运维实战笔记 — 我常用的方法与命令
linux·运维·笔记
@syh.6 小时前
【linux】进程控制
linux