gitlab代码仓库
意义:可以使用gitlab搭建私有仓库
(1)软件安装
gitlab-ce软件下载
官网:https://about.gitlab.com/install/
官方下载慢,推荐使用国内镜像站点:
https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/
安装(官方推荐至少4G内存):
yum install -y curl policycoreutils-python openssh-server ##先安装上一些依赖性
yum install -y gitlab-ce-12.8.5-ce.0.el7.x86_64.rpm ##安装gitlab-ce软件包
vim /etc/gitlab/gitlab.rb ##编辑配置文件
gitlab-ctl reconfigure ##重载服务
gitlab常用命令:
gitlab-ctl start | 启动所有 gitlab 组件 |
---|---|
gitlab-ctl stop | 停止所有 gitlab 组件 |
gitlab-ctl restart | 重启所有 gitlab 组件 |
gitlab-ctl status | 查看服务状态 |
gitlab-ctl reconfigure | 重载服务 |
gitlab-ctl tail | 查看日志 |
(2)gitlab的使用
登陆gitlab: http://192.168.43.10 ##第一次需要强制更新密码
添加ssh密钥:
首先需要生成一个或现有的key
在gitlab上粘贴ssh公钥
现在我们在主机server1上克隆私有仓库里面的内容,也向私有仓库中push推送数据。
vim /root/demo/index.html ##在demo工作目录下创建一个文件