私有仓库GitLab快速入门篇

时间:2023-03-09 04:49:15
私有仓库GitLab快速入门篇

                私有仓库GitLab快速入门篇

                                     作者:尹正杰

版权声明:原创作品,谢绝转载!否则将追究法律责任。

  安装文档请参考官网:https://about.gitlab.com/installation/#centos-7。当然根据本篇博客的步骤走也是可以成功部署GitLab的哟。

一.GitLab简介

1>.什么是GitLab

  GitLab 是一个用于仓库管理系统的开源项目。使用Git作为代码管理工具,并在此基础上搭建起来的web服务。可通过Web界面进行访问公开的或者私人项目。它拥有与Github类似的功能,能够浏览源代码,管理缺陷和注释。可以管理团队对仓库的访问,它非常易于浏览提交过的版本并提供一个文件历史库。团队成员可以利用内置的简单聊天程序(Wall)进行交流。它还提供一个代码片段收集功能可以轻松实现代码复用。

 2>.常用的网站

  官网:https://about.gitlab.com/

  国内镜像:https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/

 3>.安装GitLab的操纵系统环境

[root@yinzhengjie ~]# cat /etc/redhat-release
CentOS Linux release 7.2. (Core)
[root@yinzhengjie ~]#
[root@yinzhengjie ~]# free -m
total used free shared buff/cache available
Mem:
Swap:
[root@yinzhengjie ~]#
[root@yinzhengjie ~]# uname -r
3.10.-.el7.x86_64
[root@yinzhengjie ~]#
[root@yinzhengjie ~]# uname -m
x86_64
[root@yinzhengjie ~]#
[root@yinzhengjie ~]# ifconfig | grep broadcast | awk '{print $2}'
172.30.1.101
[root@yinzhengjie ~]#
[root@yinzhengjie ~]#
[root@yinzhengjie ~]# cat /etc/hosts | grep 172.30.1.101
172.30.1.101 www.yinzhengjie.org.cn
[root@yinzhengjie ~]#

二.GitLab部署

1>.安装GitLab依赖包

[root@yinzhengjie download]# yum install -y curl policycoreutils-python openssh-server openssh-clients
Loaded plugins: fastestmirror
base | 3.6 kB ::
elasticsearch-.x | 2.9 kB ::
extras | 3.4 kB ::
mysql-connectors-community | 2.5 kB ::
mysql-tools-community | 2.5 kB ::
mysql56-community | 2.5 kB ::
updates | 3.4 kB ::
Loading mirror speeds from cached hostfile
* base: mirrors.huaweicloud.com
* extras: mirrors.shu.edu.cn
* updates: mirrors.huaweicloud.com
Resolving Dependencies
--> Running transaction check
---> Package curl.x86_64 :7.29.-.el7.centos will be updated
---> Package curl.x86_64 :7.29.-.el7 will be an update
--> Processing Dependency: libcurl = 7.29.-.el7 for package: curl-7.29.-.el7.x86_64
---> Package openssh-server.x86_64 :6.6.1p1-.el7 will be updated
---> Package openssh-server.x86_64 :.4p1-.el7 will be an update
--> Processing Dependency: openssh = .4p1-.el7 for package: openssh-server-.4p1-.el7.x86_64
---> Package policycoreutils-python.x86_64 :2.5-.el7 will be installed
--> Processing Dependency: policycoreutils = 2.5-.el7 for package: policycoreutils-python-2.5-.el7.x86_64
--> Processing Dependency: setools-libs >= 3.3.- for package: policycoreutils-python-2.5-.el7.x86_64
--> Processing Dependency: libsemanage-python >= 2.5- for package: policycoreutils-python-2.5-.el7.x86_64
--> Processing Dependency: audit-libs-python >= 2.1.- for package: policycoreutils-python-2.5-.el7.x86_64
--> Processing Dependency: python-IPy for package: policycoreutils-python-2.5-.el7.x86_64
--> Processing Dependency: libselinux-python for package: policycoreutils-python-2.5-.el7.x86_64
--> Processing Dependency: libqpol.so.(VERS_1.)(64bit) for package: policycoreutils-python-2.5-.el7.x86_64
--> Processing Dependency: libqpol.so.(VERS_1.)(64bit) for package: policycoreutils-python-2.5-.el7.x86_64
--> Processing Dependency: libcgroup for package: policycoreutils-python-2.5-.el7.x86_64
--> Processing Dependency: libapol.so.(VERS_4.)(64bit) for package: policycoreutils-python-2.5-.el7.x86_64
--> Processing Dependency: checkpolicy for package: policycoreutils-python-2.5-.el7.x86_64
--> Processing Dependency: libqpol.so.()(64bit) for package: policycoreutils-python-2.5-.el7.x86_64
--> Processing Dependency: libapol.so.()(64bit) for package: policycoreutils-python-2.5-.el7.x86_64
--> Running transaction check
---> Package audit-libs-python.x86_64 :2.8.-.el7_5. will be installed
--> Processing Dependency: audit-libs(x86-) = 2.8.-.el7_5. for package: audit-libs-python-2.8.-.el7_5..x86_64
---> Package checkpolicy.x86_64 :2.5-.el7 will be installed
---> Package libcgroup.x86_64 :0.41-.el7 will be installed
---> Package libcurl.x86_64 :7.29.-.el7.centos will be updated
---> Package libcurl.x86_64 :7.29.-.el7 will be an update
---> Package libselinux-python.x86_64 :2.5-.el7 will be installed
---> Package libsemanage-python.x86_64 :2.5-.el7 will be installed
--> Processing Dependency: libsemanage = 2.5-.el7 for package: libsemanage-python-2.5-.el7.x86_64
--> Processing Dependency: libsemanage.so.(LIBSEMANAGE_1.)(64bit) for package: libsemanage-python-2.5-.el7.x86_64
---> Package openssh.x86_64 :6.6.1p1-.el7 will be updated
--> Processing Dependency: openssh = 6.6.1p1-.el7 for package: openssh-clients-6.6.1p1-.el7.x86_64
---> Package openssh.x86_64 :.4p1-.el7 will be an update
---> Package policycoreutils.x86_64 :2.2.-.el7 will be updated
---> Package policycoreutils.x86_64 :2.5-.el7 will be an update
---> Package python-IPy.noarch :0.75-.el7 will be installed
---> Package setools-libs.x86_64 :3.3.-.el7 will be installed
--> Running transaction check
---> Package audit-libs.x86_64 :2.4.-.el7 will be updated
--> Processing Dependency: audit-libs = 2.4.-.el7 for package: audit-2.4.-.el7.x86_64
---> Package audit-libs.x86_64 :2.8.-.el7_5. will be an update
---> Package libsemanage.x86_64 :2.1.-.el7 will be updated
---> Package libsemanage.x86_64 :2.5-.el7 will be an update
---> Package openssh-clients.x86_64 :6.6.1p1-.el7 will be updated
---> Package openssh-clients.x86_64 :.4p1-.el7 will be an update
--> Running transaction check
---> Package audit.x86_64 :2.4.-.el7 will be updated
---> Package audit.x86_64 :2.8.-.el7_5. will be an update
--> Processing Conflict: libsemanage-2.5-.el7.x86_64 conflicts selinux-policy-base < 3.13.-
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package selinux-policy-targeted.noarch :3.13.-.el7 will be updated
---> Package selinux-policy-targeted.noarch :3.13.-.el7_5. will be an update
--> Processing Dependency: selinux-policy = 3.13.-.el7_5. for package: selinux-policy-targeted-3.13.-.el7_5..noarch
--> Processing Dependency: selinux-policy = 3.13.-.el7_5. for package: selinux-policy-targeted-3.13.-.el7_5..noarch
--> Running transaction check
---> Package selinux-policy.noarch :3.13.-.el7 will be updated
---> Package selinux-policy.noarch :3.13.-.el7_5. will be an update
--> Finished Dependency Resolution Dependencies Resolved =============================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================
Installing:
policycoreutils-python x86_64 2.5-.el7 base k
Updating:
curl x86_64 7.29.-.el7 base k
openssh-server x86_64 .4p1-.el7 base k
selinux-policy-targeted noarch 3.13.-.el7_5. updates 6.6 M
Installing for dependencies:
audit-libs-python x86_64 2.8.-.el7_5. updates k
checkpolicy x86_64 2.5-.el7 base k
libcgroup x86_64 0.41-.el7 base k
libselinux-python x86_64 2.5-.el7 base k
libsemanage-python x86_64 2.5-.el7 base k
python-IPy noarch 0.75-.el7 base k
setools-libs x86_64 3.3.-.el7 base k
Updating for dependencies:
audit x86_64 2.8.-.el7_5. updates k
audit-libs x86_64 2.8.-.el7_5. updates k
libcurl x86_64 7.29.-.el7 base k
libsemanage x86_64 2.5-.el7 base k
openssh x86_64 .4p1-.el7 base k
openssh-clients x86_64 .4p1-.el7 base k
policycoreutils x86_64 2.5-.el7 base k
selinux-policy noarch 3.13.-.el7_5. updates k Transaction Summary
=============================================================================================================================================
Install Package (+ Dependent packages)
Upgrade Packages (+ Dependent packages) Total download size: M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(/): audit-2.8.-.el7_5..x86_64.rpm | kB ::
(/): curl-7.29.-.el7.x86_64.rpm | kB ::
(/): libcurl-7.29.-.el7.x86_64.rpm | kB ::
(/): audit-libs-2.8.-.el7_5..x86_64.rpm | kB ::
(/): libselinux-python-2.5-.el7.x86_64.rpm | kB ::
(/): libsemanage-python-2.5-.el7.x86_64.rpm | kB ::
(/): libcgroup-0.41-.el7.x86_64.rpm | kB ::
(/): openssh-.4p1-.el7.x86_64.rpm | kB ::
(/): checkpolicy-2.5-.el7.x86_64.rpm | kB ::
(/): openssh-server-.4p1-.el7.x86_64.rpm | kB ::
(/): policycoreutils-2.5-.el7.x86_64.rpm | kB ::
(/): python-IPy-0.75-.el7.noarch.rpm | kB ::
(/): policycoreutils-python-2.5-.el7.x86_64.rpm | kB ::
(/): libsemanage-2.5-.el7.x86_64.rpm | kB ::
(/): selinux-policy-3.13.-.el7_5..noarch.rpm | kB ::
(/): setools-libs-3.3.-.el7.x86_64.rpm | kB ::
(/): openssh-clients-.4p1-.el7.x86_64.rpm | kB ::
(/): selinux-policy-targeted-3.13.-.el7_5..noarch.rpm | 6.6 MB ::
audit-libs-python-2.8.-.el7_ FAILED
http://centos.ustc.edu.cn/centos/7.5.1804/updates/x86_64/Packages/audit-libs-python-2.8.1-3.el7_5.1.x86_64.rpm: [Errno 14] curl#7 - "Failed to connect to 2001:da8:d800:95::110: Network is unreachable"
Trying other mirror.
(/): audit-libs-python-2.8.-.el7_5..x86_64.rpm | kB ::
---------------------------------------------------------------------------------------------------------------------------------------------
Total kB/s | MB ::
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Updating : audit-libs-2.8.-.el7_5..x86_64 /
Updating : libsemanage-2.5-.el7.x86_64 /
Updating : policycoreutils-2.5-.el7.x86_64 /
Updating : openssh-.4p1-.el7.x86_64 /
Updating : selinux-policy-3.13.-.el7_5..noarch /
Installing : libsemanage-python-2.5-.el7.x86_64 /
Installing : audit-libs-python-2.8.-.el7_5..x86_64 /
Installing : checkpolicy-2.5-.el7.x86_64 /
Installing : libcgroup-0.41-.el7.x86_64 /
Updating : libcurl-7.29.-.el7.x86_64 /
Installing : python-IPy-0.75-.el7.noarch /
Installing : libselinux-python-2.5-.el7.x86_64 /
Installing : setools-libs-3.3.-.el7.x86_64 /
Installing : policycoreutils-python-2.5-.el7.x86_64 /
Updating : curl-7.29.-.el7.x86_64 /
Updating : selinux-policy-targeted-3.13.-.el7_5..noarch /
Updating : openssh-server-.4p1-.el7.x86_64 /
Updating : openssh-clients-.4p1-.el7.x86_64 /
Updating : audit-2.8.-.el7_5..x86_64 /
Cleanup : selinux-policy-targeted-3.13.-.el7.noarch /
Cleanup : openssh-server-6.6.1p1-.el7.x86_64 /
Cleanup : selinux-policy-3.13.-.el7.noarch /
Cleanup : policycoreutils-2.2.-.el7.x86_64 /
Cleanup : libsemanage-2.1.-.el7.x86_64 /
Cleanup : openssh-clients-6.6.1p1-.el7.x86_64 /
Cleanup : openssh-6.6.1p1-.el7.x86_64 /
Cleanup : audit-2.4.-.el7.x86_64 /
Cleanup : curl-7.29.-.el7.centos.x86_64 /
Cleanup : libcurl-7.29.-.el7.centos.x86_64 /
Cleanup : audit-libs-2.4.-.el7.x86_64 /
Verifying : libsemanage-python-2.5-.el7.x86_64 /
Verifying : libsemanage-2.5-.el7.x86_64 /
Verifying : setools-libs-3.3.-.el7.x86_64 /
Verifying : audit-libs-python-2.8.-.el7_5..x86_64 /
Verifying : curl-7.29.-.el7.x86_64 /
Verifying : policycoreutils-2.5-.el7.x86_64 /
Verifying : audit-2.8.-.el7_5..x86_64 /
Verifying : openssh-server-.4p1-.el7.x86_64 /
Verifying : libselinux-python-2.5-.el7.x86_64 /
Verifying : policycoreutils-python-2.5-.el7.x86_64 /
Verifying : python-IPy-0.75-.el7.noarch /
Verifying : selinux-policy-targeted-3.13.-.el7_5..noarch /
Verifying : libcurl-7.29.-.el7.x86_64 /
Verifying : libcgroup-0.41-.el7.x86_64 /
Verifying : audit-libs-2.8.-.el7_5..x86_64 /
Verifying : openssh-.4p1-.el7.x86_64 /
Verifying : openssh-clients-.4p1-.el7.x86_64 /
Verifying : selinux-policy-3.13.-.el7_5..noarch /
Verifying : checkpolicy-2.5-.el7.x86_64 /
Verifying : curl-7.29.-.el7.centos.x86_64 /
Verifying : openssh-6.6.1p1-.el7.x86_64 /
Verifying : selinux-policy-targeted-3.13.-.el7.noarch /
Verifying : openssh-clients-6.6.1p1-.el7.x86_64 /
Verifying : libsemanage-2.1.-.el7.x86_64 /
Verifying : selinux-policy-3.13.-.el7.noarch /
Verifying : libcurl-7.29.-.el7.centos.x86_64 /
Verifying : openssh-server-6.6.1p1-.el7.x86_64 /
Verifying : audit-libs-2.4.-.el7.x86_64 /
Verifying : policycoreutils-2.2.-.el7.x86_64 /
Verifying : audit-2.4.-.el7.x86_64 / Installed:
policycoreutils-python.x86_64 :2.5-.el7 Dependency Installed:
audit-libs-python.x86_64 :2.8.-.el7_5. checkpolicy.x86_64 :2.5-.el7 libcgroup.x86_64 :0.41-.el7
libselinux-python.x86_64 :2.5-.el7 libsemanage-python.x86_64 :2.5-.el7 python-IPy.noarch :0.75-.el7
setools-libs.x86_64 :3.3.-.el7 Updated:
curl.x86_64 :7.29.-.el7 openssh-server.x86_64 :.4p1-.el7 selinux-policy-targeted.noarch :3.13.-.el7_5. Dependency Updated:
audit.x86_64 :2.8.-.el7_5. audit-libs.x86_64 :2.8.-.el7_5. libcurl.x86_64 :7.29.-.el7
libsemanage.x86_64 :2.5-.el7 openssh.x86_64 :.4p1-.el7 openssh-clients.x86_64 :.4p1-.el7
policycoreutils.x86_64 :2.5-.el7 selinux-policy.noarch :3.13.-.el7_5. Complete!
[root@yinzhengjie download]#

[root@yinzhengjie download]# yum install -y curl policycoreutils-python openssh-server openssh-clients

2>.下载GitLab的rpm包

[root@yinzhengjie ~]# cd download/
[root@yinzhengjie download]# ll
total
-rw-r--r-- root root Sep : apache-tomcat-9.0..tar.gz
[root@yinzhengjie download]#
[root@yinzhengjie download]#
[root@yinzhengjie download]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.6-ce.0.el7.x86_64.rpm
---- ::-- https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.6-ce.0.el7.x86_64.rpm
Resolving mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.8.193, :f000:::::
Connecting to mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.8.193|:... connected.
HTTP request sent, awaiting response... OK
Length: (343M) [application/x-redhat-package-manager]
Saving to: ‘gitlab-ce-10.0.-ce..el7.x86_64.rpm’ %[===================================================================================================>] ,, .39MB/s in 4m 6s -- :: (1.39 MB/s) - ‘gitlab-ce-10.0.-ce..el7.x86_64.rpm’ saved [/] [root@yinzhengjie download]# ll
total
-rw-r--r-- root root Sep : apache-tomcat-9.0..tar.gz
-rw-r--r-- root root Nov gitlab-ce-10.0.-ce..el7.x86_64.rpm
[root@yinzhengjie download]#

[root@yinzhengjie download]# 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@yinzhengjie download]# yum -y localinstall gitlab-ce-10.0.-ce..el7.x86_64.rpm
Loaded plugins: fastestmirror
Examining gitlab-ce-10.0.-ce..el7.x86_64.rpm: gitlab-ce-10.0.-ce..el7.x86_64
Marking gitlab-ce-10.0.-ce..el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package gitlab-ce.x86_64 :10.0.-ce..el7 will be installed
--> Finished Dependency Resolution Dependencies Resolved =============================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================
Installing:
gitlab-ce x86_64 10.0.-ce..el7 /gitlab-ce-10.0.-ce..el7.x86_64 1.0 G Transaction Summary
=============================================================================================================================================
Install Package Total size: 1.0 G
Installed size: 1.0 G
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : gitlab-ce-10.0.-ce..el7.x86_64 /
It looks like GitLab has not been configured yet; skipping the upgrade script. *. *.
*** ***
***** *****
.****** *******
******** ********
,,,,,,,,,***********,,,,,,,,,
,,,,,,,,,,,*********,,,,,,,,,,,
.,,,,,,,,,,,*******,,,,,,,,,,,,
,,,,,,,,,*****,,,,,,,,,.
,,,,,,,****,,,,,,
.,,,***,,,,
,*,. _______ __ __ __
/ ____(_) /_/ / ____ _/ /_
/ / __/ / __/ / / __ \`/ __ \
/ /_/ / / /_/ /___/ /_/ / /_/ /
\____/_/\__/_____/\__,_/_.___/ Thank you for installing GitLab!
GitLab was unable to detect a valid hostname for your instance.
Please configure a URL for your GitLab instance by setting `external_url`
configuration in /etc/gitlab/gitlab.rb file.
Then, you can start your GitLab instance by running the following command:
sudo gitlab-ctl reconfigure For a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md Verifying : gitlab-ce-10.0.-ce..el7.x86_64 / Installed:
gitlab-ce.x86_64 :10.0.-ce..el7 Complete!
[root@yinzhengjie download]#

[root@yinzhengjie download]# yum -y localinstall gitlab-ce-10.0.6-ce.0.el7.x86_64.rpm

4>.修改GitLab的主配置文件

私有仓库GitLab快速入门篇

5>.初始化GitLab,就执行一次

[root@yinzhengjie download]# gitlab-ctl reconfigure

私有仓库GitLab快速入门篇

6>.管理GitLab服务的常用命令

[root@yinzhengjie download]# gitlab-ctl start
ok: run: gitaly: (pid ) 119s
ok: run: gitlab-monitor: (pid ) 118s
ok: run: gitlab-workhorse: (pid ) 119s
ok: run: logrotate: (pid ) 148s
ok: run: nginx: (pid ) 150s
ok: run: node-exporter: (pid ) 142s
ok: run: postgres-exporter: (pid ) 118s
ok: run: postgresql: (pid ) 188s
ok: run: prometheus: (pid ) 118s
ok: run: redis: (pid ) 194s
ok: run: redis-exporter: (pid ) 138s
ok: run: sidekiq: (pid ) 160s
ok: run: unicorn: (pid ) 162s
[root@yinzhengjie download]#

启动GitLab服务([root@yinzhengjie download]# gitlab-ctl start)

[root@yinzhengjie download]# gitlab-ctl status
run: gitaly: (pid ) 123s; run: log: (pid ) 162s
run: gitlab-monitor: (pid ) 122s; run: log: (pid ) 144s
run: gitlab-workhorse: (pid ) 123s; run: log: (pid ) 156s
run: logrotate: (pid ) 152s; run: log: (pid ) 152s
run: nginx: (pid ) 154s; run: log: (pid ) 154s
run: node-exporter: (pid ) 146s; run: log: (pid ) 146s
run: postgres-exporter: (pid ) 122s; run: log: (pid ) 134s
run: postgresql: (pid ) 192s; run: log: (pid ) 192s
run: prometheus: (pid ) 122s; run: log: (pid ) 136s
run: redis: (pid ) 198s; run: log: (pid ) 198s
run: redis-exporter: (pid ) 142s; run: log: (pid ) 142s
run: sidekiq: (pid ) 164s; run: log: (pid ) 164s
run: unicorn: (pid ) 166s; run: log: (pid ) 166s
[root@yinzhengjie download]#

查看GitLab的状态([root@yinzhengjie download]# gitlab-ctl status)

[root@yinzhengjie download]# gitlab-ctl stop
ok: down: gitaly: 0s, normally up
ok: down: gitlab-monitor: 1s, normally up
ok: down: gitlab-workhorse: 0s, normally up
ok: down: logrotate: 0s, normally up
ok: down: nginx: 1s, normally up
ok: down: node-exporter: 0s, normally up
ok: down: postgres-exporter: 1s, normally up
ok: down: postgresql: 0s, normally up
ok: down: prometheus: 1s, normally up
ok: down: redis: 0s, normally up
ok: down: redis-exporter: 0s, normally up
ok: down: sidekiq: 0s, normally up
ok: down: unicorn: 1s, normally up
[root@yinzhengjie download]#
[root@yinzhengjie download]#
[root@yinzhengjie download]#
[root@yinzhengjie download]# gitlab-ctl status
down: gitaly: 8s, normally up; run: log: (pid ) 690s
down: gitlab-monitor: 8s, normally up; run: log: (pid ) 672s
down: gitlab-workhorse: 7s, normally up; run: log: (pid ) 684s
down: logrotate: 7s, normally up; run: log: (pid ) 680s
down: nginx: 7s, normally up; run: log: (pid ) 682s
down: node-exporter: 6s, normally up; run: log: (pid ) 674s
down: postgres-exporter: 6s, normally up; run: log: (pid ) 662s
down: postgresql: 5s, normally up; run: log: (pid ) 720s
down: prometheus: 5s, normally up; run: log: (pid ) 664s
down: redis: 4s, normally up; run: log: (pid ) 726s
down: redis-exporter: 4s, normally up; run: log: (pid ) 670s
down: sidekiq: 3s, normally up; run: log: (pid ) 692s
down: unicorn: 3s, normally up; run: log: (pid ) 694s
[root@yinzhengjie download]#
[root@yinzhengjie download]#

停止GitLab服务([root@yinzhengjie download]# gitlab-ctl stop)

7>.通过webUI访问GitLab,设置初始密码

私有仓库GitLab快速入门篇

8>.登录GitLab

私有仓库GitLab快速入门篇

9>.登录成功后会有以下界面

私有仓库GitLab快速入门篇

10>.GitLab的安装和日志存放位置

[root@yinzhengjie download]# ll /opt/gitlab/
total
drwxr-xr-x root root Sep : bin
-rw-r--r-- root root Nov dependency_licenses.json
drwxr-xr-x root root Sep : embedded
drwxr-xr-x root root Sep : etc
drwxr-xr-x root root Sep : init
-rw-r--r-- root root Nov LICENSE
drwxr-xr-x root root Sep : LICENSES
drwxr-xr-x root root Sep : service
drwxr-xr-x root root Sep : sv
drwxr-xr-x root root Sep : var
-rw-r--r-- root root Nov version-manifest.json
-rw-r--r-- root root Nov version-manifest.txt
[root@yinzhengjie download]#

GitLab的安装位置([root@yinzhengjie download]# ll /opt/gitlab/)

[root@yinzhengjie download]# ll /var/log/gitlab/
total
drwx------ git root Sep : gitaly
drwx------ git root Sep : gitlab-monitor
drwx------ git root Sep : gitlab-rails
drwx------ git root Sep : gitlab-shell
drwx------ git root Sep : gitlab-workhorse
drwx------ root root Sep : logrotate
drwxr-x--- root gitlab-www Sep : nginx
drwx------ gitlab-prometheus root Sep : node-exporter
drwx------ gitlab-psql root Sep : postgres-exporter
drwx------ gitlab-psql root Sep : postgresql
drwx------ gitlab-prometheus root Sep : prometheus
drwxr-xr-x root root Sep : reconfigure
drwx------ gitlab-redis root Sep : redis
drwx------ gitlab-redis root Sep : redis-exporter
drwx------ git root Sep : sidekiq
drwx------ git root Sep : unicorn
[root@yinzhengjie download]#

GitLab的日志存放位置([root@yinzhengjie download]# ll /var/log/gitlab/)

[root@yinzhengjie ~]# ll /etc/gitlab/
total
-rw------- root root Sep : gitlab.rb
-rw------- root root Sep : gitlab-secrets.json
drwxr-xr-x root root Sep : trusted-certs
[root@yinzhengjie ~]#

GitLab配置文件存放目录([root@yinzhengjie ~]# ll /etc/gitlab/)

三.使用GitLab步骤详解

1>.点击新建项目

私有仓库GitLab快速入门篇

2>.编辑新建项目信息

私有仓库GitLab快速入门篇

3>创建项目成功后的界面

私有仓库GitLab快速入门篇

4>配置秘钥登录-点击“add an SSH key”

私有仓库GitLab快速入门篇

5>配置秘钥登录-将服务器端的秘钥id拷贝到GitLab的webUI界面上

  关于配置SSH免密码登录大家可以参考我以前的笔记:https://www.cnblogs.com/yinzhengjie/p/9065191.html。

私有仓库GitLab快速入门篇

6>.配置秘钥登录-配置成功的界面

私有仓库GitLab快速入门篇

7>.创建新仓库-查看帮助信息

私有仓库GitLab快速入门篇

8>.创建新仓库-克隆gitlab的项目到服务器本地

[root@yinzhengjie ~]# ll
total
drwxr-xr-x root root Sep : download
drwxr-xr-x root root Sep : 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::e8:e7::d4:c2:4c:e0::7e:9c:d8::d8:.
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
drwxr-xr-x root root Sep : download
drwxr-xr-x root root Sep : git_data
drwxr-xr-x root root Sep : yinzhengjieCode
[root@yinzhengjie ~]#
[root@yinzhengjie ~]# cd yinzhengjieCode/
[root@yinzhengjie yinzhengjieCode]#
[root@yinzhengjie yinzhengjieCode]# ll
total
[root@yinzhengjie yinzhengjieCode]#
[root@yinzhengjie yinzhengjieCode]#

[root@yinzhengjie ~]# git clone git@www.yinzhengjie.org.cn:root/yinzhengjieCode.git   #将gitlab的数据下载到本地服务器中

[root@yinzhengjie ~]# cd yinzhengjieCode/
[root@yinzhengjie yinzhengjieCode]#
[root@yinzhengjie yinzhengjieCode]# ll
total
[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, insertions(+), deletions(-)
create mode README.md
[root@yinzhengjie yinzhengjieCode]# git push -u origin master #将数据推送到gitlab中
Counting objects: , done.
Writing objects: % (/), bytes | bytes/s, done.
Total (delta ), reused (delta )
To git@www.yinzhengjie.org.cn:root/yinzhengjieCode.git
* [new branch] master -> master
Branch master set up to track remote branch master from origin.
[root@yinzhengjie yinzhengjieCode]#
[root@yinzhengjie yinzhengjieCode]#

[root@yinzhengjie yinzhengjieCode]# git push -u origin master               #将数据推送到gitlab中

私有仓库GitLab快速入门篇

9>.在网页上编辑文件

私有仓库GitLab快速入门篇

10>.在网页上编辑完成后点击提交并查看修改后的内容

私有仓库GitLab快速入门篇

11>.在服务器端查看编译后的文件内容

[root@yinzhengjie yinzhengjieCode]# ll
total
-rw-r--r-- root root Sep : README.md
[root@yinzhengjie yinzhengjieCode]#
[root@yinzhengjie yinzhengjieCode]# cat README.md
http://www.cnblogs.com/yinzhengjie
http://www.cnblogs.com/yinzhengjie
[root@yinzhengjie yinzhengjieCode]#
[root@yinzhengjie yinzhengjieCode]# git pull
remote: Counting objects: , done.
remote: Compressing objects: % (/), done.
remote: Total (delta ), reused (delta )
Unpacking objects: % (/), done.
From www.yinzhengjie.org.cn:root/yinzhengjieCode
abe070d..a697c69 master -> origin/master
Auto-merging README.md
CONFLICT (content): Merge conflict in README.md
Automatic merge failed; fix conflicts and then commit the result.
[root@yinzhengjie yinzhengjieCode]#
[root@yinzhengjie yinzhengjieCode]# ll
total
-rw-r--r-- root root Sep : README.md
[root@yinzhengjie yinzhengjieCode]#
[root@yinzhengjie yinzhengjieCode]# cat README.md
http://www.cnblogs.com/yinzhengjie
<<<<<<< HEAD
http://www.cnblogs.com/yinzhengjie
======= 尹正杰到此一游!!!! 大数据 自动化运维 人工智能 深度学习 >>>>>>> a697c6969dff86c6743060f0d829090508eb1243
[root@yinzhengjie yinzhengjieCode]#