GitLab 搭建与使用

操作系统:Centos 7

环境:VM虚拟机

  • 0x00:这里说下VM 虚拟机的配置

 

然后选择NAT模式

接下来配置网络

cd /etc/sysconfig/network-scripts/
编辑:vi ifcfg-ens33   
改为静态地址:BOOTPROTOt=static
开机启动:NOBOOT=yes
新增网卡信息:
然后设置物理机地址,调至虚拟机与物理机相互ping通
  • 下载安装GitLab

安装ssh

sudo yum install -y curl policycoreutils-pythonopenssh-server

ssh开机启动

sudo systemctl enable sshd

防火墙开启http

sudo firewall-cmd --permanent --add-service=http

安装postfix

sudo yum install postfix

postfix设置开机启动

sudo systemctl enable postfix

安装wget

yum -y install wget

安装gitlab

镜像地址:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm

 

安装git:

配置gitlab服务器ip和端口:

vi  /etc/gitlab/gitlab.rb

修改红色字体部分为IP和端口:

此处端口设置与上面文件相同

防火墙开启对应端口:

firewall-cmd --permanent --zone=public --remove-port=8090/tcp

下图firewall-cmd --relaod报错原因是单词打错了 应为reload

之前安装的软件记得启动

gitlab-ctlreconfigure

gitlab-ctl restart

 

  • git的使用

git项目中获取地址后在本地连接远程项目获取代码

连接之后进入文件夹并切换(创建)分支

git pull origin xxxx拉去 xxxx分支
 
编辑代码
添加修改项:
 
git status 查看状态
git add xxxxxxxx 添加修改项
完成后 git commit 并添加注释

 git push origin xxxxxxxx 上传代码到分支xxxxxxxx
 

 

 

posted on 2019-02-27 23:49  Ra7ing安全实验室  阅读(212)  评论(0)    收藏  举报

导航