--------------------------------------------gitlab簡介-------------------------------------------------------python
1.什麼是gitlabgit
GitLab 是一個用於倉庫管理系統的開源項目。使用Git做爲代碼管理工具,並在此基礎上搭建起來的web服務。可經過Web界面進行訪問公開的或者私人項目。它擁有與Github相似的功能,可以瀏覽源代碼,管理缺陷和註釋。能夠管理團隊對倉庫的訪問,它很是易於瀏覽提交過的版本並提供一個文件歷史庫。團隊成員能夠利用內置的簡單聊天程序(Wall)進行交流。它還提供一個代碼片斷收集功能能夠輕鬆實現代碼複用web
2.經常使用的網站vim
官網:https://about.gitlab.com/服務器
國內鏡像:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/app
---------------------------------------------------------------------------------------------------------------------------------------運維
>>環境簡述:ssh
1.服務器系統環境:curl
[root@bogon liujiingCode]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core) 工具
[root@bogon liujiingCode]# cat /etc/hosts|grep 192.168.10.128
192.168.10.128 www.liujing.com
>>部署gitlab
1.安裝gitlab依賴包
[root@bogon ~]# yum install -y curl policycoreutils-python openssh-server openssh-clients
2.下載gitlab的rpm 包
[root@bogon ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.6-ce.0.el7.x86_64.rpm
3.經過yum 本地安裝Gitlab
[root@www download]# yum -y localinstall gitlab-ce-10.0.6-ce.0.el7.x86_64.rpm
4.修改gitlab的主配置文件
vim /etc/gitlab/gitlab.rb(下圖中192.168.10.128改爲本身gitlab服務器的IP地址或域名)
5.初始化gitlab,只執行一次
[root@www download]# gitlab-ctl reconfigure ####時間有點長,耐心等待
6.管理gitlab的經常使用命令
[root@www download]#gitlab-ctl start ##啓動gitlab服務
[root@www download]#gitlab-ctl stop ##中止gitlab服務
[root@www download]#gitlab-ctl status ##查看gitlab的狀態
7.經過webUI 訪問gitlab,設置初始密碼(下圖是拷貝的)
8.登陸gitlab
9.登陸成功後會有如下界面
10.gitlab的安裝和存放目錄
>安裝目錄:
>日誌存放目錄
>配置文件存放目錄
-----------------------------------------------使用gitlab-----------------------------------
>>使用gitlab步驟詳解
1.點擊新建項目
2.編輯新建項目信息
3.建立項目成功後的界面
4.配置祕鑰登陸-點擊「add an ssh key」
5.將服務器端的公鑰複製到gitlab的webUI界面上
6.配置祕鑰登陸-配置成功的界面(圖片拷貝的)
7.建立新倉庫-查看幫助信息
8.建立新倉庫-克隆gitlab的項目到服務器本地
>.將gitlab的數據下載到本地服務器中
[root@yinzhengjie ~]# ll
total 0
drwxr-xr-x 2 root root 83 Sep 9 01:50 download
drwxr-xr-x 3 root root 45 Sep 8 23:13 git_data
[root@yinzhengjie ~]#
[root@yinzhengjie ~]# git clone git@www.yinzhengjie.org.cn:root/yinzhengjieCode.git
Cloning into 'yinzhengjieCode'...
The authenticity of host 'www.yinzhengjie.org.cn (172.30.1.101)' can't be established.
ECDSA key fingerprint is SHA256:1MkICaFrw0jl80J9+gRJBa4W1QjDRafGqrFzRzae81E.
ECDSA key fingerprint is MD5:b6:44:e8:e7:76:d4:c2:4c:e0:02:7e:9c:d8:59:d8:13.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'www.yinzhengjie.org.cn' (ECDSA) to the list of known hosts.
warning: You appear to have cloned an empty repository.
[root@yinzhengjie ~]#
[root@yinzhengjie ~]# ll
total 0
drwxr-xr-x 2 root root 83 Sep 9 01:50 download
drwxr-xr-x 3 root root 45 Sep 8 23:13 git_data
drwxr-xr-x 3 root root 17 Sep 9 04:08 yinzhengjieCode
>.將數據推送到gitlab中
[root@yinzhengjie ~]# cd yinzhengjieCode/
[root@yinzhengjie yinzhengjieCode]#
[root@yinzhengjie yinzhengjieCode]# ll
total 0
[root@yinzhengjie yinzhengjieCode]#
[root@yinzhengjie yinzhengjieCode]# touch README.md
[root@yinzhengjie yinzhengjieCode]# echo http://www.cnblogs.com/yinzhengjie >> README.md
[root@yinzhengjie yinzhengjieCode]# git add README.md
[root@yinzhengjie yinzhengjieCode]# git commit -m "add README"
[master (root-commit) 64b2f56] add README
file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 README.md
[root@yinzhengjie yinzhengjieCode]# git push -u origin master #將數據推送到gitlab中
Counting objects: 3, done.
Writing objects: 100% (3/3), 217 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@www.yinzhengjie.org.cn:root/yinzhengjieCode.git
* [new branch] master -> master
Branch master set up to track remote branch master from origin.
9.在網頁上編輯
10.在網頁上編輯完成後點擊提交併查看修改後的內容
11.在服務器端查看修改的內容
[root@www liujiingCode]# ls
README.md
[root@www liujiingCode]# cat README.md
http://www.cnblogs.com/liujing
劉敬,到此一遊
大數據
人工智能
自動化運維