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


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

可以在浏览器合并分支
相关推荐
kyle~5 小时前
Linux --- epoll (I/O就绪事件通知机制)
linux·运维·服务器
AlfredZhao5 小时前
进程都杀了,为什么 `netstat` 还能看到端口?
linux
一条泥憨鱼6 小时前
【从0开始学习计算机网络】| 邮件协议入门:SMTP、POP3、IMAP
linux·运维·计算机网络·github
LJianK16 小时前
服务器、节点 、 集群、分布式
运维
姚不倒7 小时前
etcd 学习系列(四):存储模型 —— WAL 和 Snapshot 是如何配合的
运维·etcd
come112347 小时前
Nginx `location` 配置说明(后端开发版)
运维·nginx
SkyWalking中文站14 小时前
SkyWalking 11 与 BanyanDB 0.11:在存储引擎内部实现 Trace 尾部采样
运维·监控·自动化运维
姚不倒15 小时前
etcd 学习系列(二):集群架构 —— 3 节点是如何工作的
运维·架构·etcd
pt104316 小时前
网络自动化Python课程:Cisco PyATS网络自动化测试框架
运维·自动化
Johny_Zhao16 小时前
网络安全等级保护测评实施方案
linux·网络·人工智能·网络安全·信息安全·云计算·等保测评·系统运维·itsm