2018--- (Centos7) gitlab服务器搭建与使用

一、注册

gitlab官网注册入口:
https://about.gitlab.com/downloads/#centos7
https://gitlab.com/users/sign_in
这里写图片描述
一般注册免费版即可

二、安装和配置依赖项 (必需)

官方centos7配置链接:https://about.gitlab.com/installation/#centos-7

1.安装软件

sudo yum install curl policycoreutils openssh-server openssh-clients
sudo systemctl enable sshd
sudo systemctl start sshd

2.防火墙设置

sudo firewall-cmd –permanent –add-service=http
sudo systemctl reload firewalld

3.安装postfix发送通知邮件。(可跳过)

sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix

4.添加gitlab库及安装包。

官方方法:
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash

我的操作:
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

yum repolist 查看库中是否有包

5.安装gitlab包

官方方法:(安装gitlab包。改变http://gitlab.example.com的URL为你想访问的你的gitlab实例。安装将自动配置和URL开始gitlab。HTTPS需要在安装后附加配置)
sudo EXTERNAL_URL=”http://gitlab.example.com” yum install -y gitlab-ee

我的操作:
sudo yum install gitlab-ce 或 yum -y install gitlab-ce-8.14.4-ce.0.el7.x86_64.rpm

sudo gitlab-ctl reconfigure 自动配置文件权限,安装数据库(安装的时间很长)

三、访问

浏览器访问gitlab服务器网址 (GITLAB占用80端口,访问时直接访问IP就可以
,第一次会让你确认root账户登录的密码)

http://192.168.122.163
此图为确认密码后跳转的页面
此图为确认密码后跳转的页面

接着,输入root ,及第一次设的密码即可
这里写图片描述

四、创建项目

这里写图片描述

这里写图片描述

这里写图片描述

此项目的存储库是空的。
如果已经有文件,可以使用下面的命令行指令来推送它们。
否则,你可以开始添加一个自述,许可证,或gitignore这个项目。
当主分支被自动保护时,您将需要拥有或拥有初始推送的主权限级别。
它将根据预定义的CI / CD配置自动构建、测试和部署应用程序。

这里写图片描述

这里写图片描述

Command line instructions

1.Git的全局设置

git config –global user.name “Administrator”
git config –global user.email “admin@example.com”

2.创建一个新的存储库

git clone git@gitlab.example.com:root/ali.git
cd ali
touch README.md
git add README.md
git commit -m “add README”
git push -u origin master

3.现有文件夹方式

cd existing_folder
git init
git remote add origin git@gitlab.example.com:root/ali.git
git add .
git commit -m “Initial commit”
git push -u origin master

4.现有Git仓库方式

cd existing_repo
git remote rename origin old-origin
git remote add origin git@gitlab.example.com:root/ali.git
git push -u origin –all
git push -u origin –tags

这里写图片描述

五、推送SSH秘钥

1.粘贴这个地址,用于下载项目(文档容器)
http://192.168.122.163/root/ali root后为项目名

这里写图片描述

2.客户端生成秘钥
ssh-keygen

cat .ssh/id_rsa.pub

s

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

漠效

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值