Centos7 - gitlab分布式版本控制系统

安装部署gitlab

1、安装依赖包
yum install curl policycoreutils openssh-server openssh-clients
2、启动sshd服务和开机自启
systemctl enable sshd && systemctl start sshd
3、安装邮箱,并启动
yum install postfix
systemctl enable postfix
systemctl start postfix
4、关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
5、官网下载gitlab rpm包
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash(添加GitLab-YUM仓库到服务器)
yum install gitlab-ce
6、自动配置文件权限,安装数据库
gitlab-ctl reconfigure

自此,gitlab环境已经部署完毕,可以在浏览器中访问部署的gitlab环境
如果创建项目是提示没有SSH**问题,可以在服务器上面执行ssh-******命令生成**,拷贝公钥cat .ssh/id_rsa.pub到gitlab网页中,步骤如下:
Centos7 - gitlab分布式版本控制系统

图形操作

1、newfile:先新建一个文件
Centos7 - gitlab分布式版本控制系统

2、uploadfile:再上传即可
Centos7 - gitlab分布式版本控制系统

命令行操作

1、域名解析
vim /etc/hosts
服务器IP gitlab.example.com
2、克隆服务器的文件
-bash: git: 未找到命令
需要安装git
yum -y install git

使用系统内置账号git
git config --global user.name “git”(创建git账号)
git config --global user.email “[email protected]
git clone [email protected]:root/my-cloud1.git(项目名称)
3、上传文件
进入克隆服务器文件
cd my-cloud1
新建文件
echo 1234567 > 3333.sh
初始化
git init
配置远程服务器地址,如果经配置过其他远程服务器。可以用命令清除掉(git remote rm origin )
git remote add origin [email protected]:root/my-cloud1.git
建立当前文件夹下所有的文件,为准备上传的文件
git add .
提交说明
git commit -m ‘2019-12-12 12:12:12’
上传
git push -u origin master

gitlab文件备份
指令:gitlab-rake gitlab:backup:create
备份文件存放路径:/var/opt/gitlab/backups