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/*


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

可以在浏览器合并分支
相关推荐
马立杰2 小时前
H3CNE-33-BGP
运维·网络·h3cne
云空3 小时前
《DeepSeek 网页/API 性能异常(DeepSeek Web/API Degraded Performance):网络安全日志》
运维·人工智能·web安全·网络安全·开源·网络攻击模型·安全威胁分析
深度Linux3 小时前
Linux网络编程中的零拷贝:提升性能的秘密武器
linux·linux内核·零拷贝技术
没有名字的小羊4 小时前
Cyber Security 101-Build Your Cyber Security Career-Security Principles(安全原则)
运维·网络·安全
千夜啊4 小时前
Nginx 运维开发高频面试题详解
运维·nginx·运维开发
存储服务专家StorageExpert5 小时前
答疑解惑:如何监控EMC unity存储系统磁盘重构rebuild进度
运维·unity·存储维护·emc存储
chian-ocean6 小时前
从理论到实践:Linux 进程替换与 exec 系列函数
linux·运维·服务器
拎得清n7 小时前
UDP编程
linux
敖行客 Allthinker7 小时前
从 UTC 日期时间字符串获取 Unix 时间戳:C 和 C++ 中的挑战与解决方案
linux·运维·服务器·c++
JunLan~7 小时前
Docker 部署 GLPI(IT 资产管理软件系统)
运维·docker·容器