前言
每一個開發工作者無非身處2中開發環境:1.開源環境 2.閉源開發環境,若你身處閉源環境或對自己代碼安全性要求較高,搭建和使用自己GitLab服務器是必不可少的環節。
可以通過各種方式搭建自己的GitLab服務器:基於NFS、Git、SSH、GitWeb、GitLab,實現版本控制;
一、搭建GitLab服務器
0.centos7環境安裝GitLab依賴軟件、設置開機啟動
yum -y install curl policycoreutils openssh-server openssh-clents libsemanage-static libsemanage-devel yum install curlpolicycoreutils openssh-server openssh-clients systemctl enablesshd systemctl enable sshd systemctl start sshd yum install postfix systemctl enable postfix systemctl start postfix firewall-cmd --permanent --add-service=http systemctl reload firewalld
2.下載gitlab安裝包,然后安裝、啟動GitLab
yum install -y gitlab-ce
gitlab-ctl reconfigure
gitlab-ctl restart
3.訪問GitLab並設置第1個用戶root的密碼
4.root用戶登錄
5.在gitlab創建一個test項目
6.克隆gitlab服務器中項目到本地
git clone http://192.168.226.131/root/test.git
7.推送本地項目到gitlab服務器
cd test echo hello GitLib > zhanggen.txt git add . git commit -m zhanggen.txt git push origin master