版本控制gitlab

版本控制是指对软件开发过程中各种程序代码、配置文件及说明文档等文件变更的管理,是软件配置管理的核心思想之一
版本控制最主要的功能就是追踪文件的变更,它将什么时候、什么人更改了文件的什么内容等信息记录下来,每一次文件的改变,文件的版本号都将增加,除了记录版本变更外,版本控制的另一个重要的功能是并行开发。根据变更的性质使配置项的版本树继续延伸或产生新的分支,形成性的目标版本,而对于不受变更影响的配置项则不应发产生变动。同时,应能够将变更所产生的对版本的影响进行记录和跟踪,必要时还可以退回到以前的版本
版本控制是软件配置管理的核心功能。所有置于配置库中的元素都应自动予以版本的标识,并保证版本命名的唯一性。版本在生成过程中,自动依照设定的使用模型自动分支、演进。除了系统自动记录的版本信息以外,为了配合软件开发流程,并为今后对软件过程的度量做好准备。当然如果选用的工具支持,这些辅助数据将能直接统计出过程数据,从而方便软件过程改进活动的进行
常用的版本控制工具

#关闭防火墙和selinux
[[email protected] src]# systemctl stop firewalld
[[email protected] src]# setenforce 0
setenforce: SELinux is disabled
#配置yum源
[[email protected] ~]# cd /etc/yum.repos.d/
[[email protected] yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base
-163.repo
[[email protected] ~]# sed -i 's/\$releasever/7/g' /etc/yum.repos.d/CentOS7-Bas
e-163.repo
[[email protected] ~]# sed -i 's/^enabled=.*/enabled=1/g' /etc/yum.repos.d/Cent
OS7-Base-163.repo
[[email protected] ~]# yum -y install epel-release
#安装git
[[email protected] ~]# yum -y install epel-release git
#安装依赖包
[[email protected] ~]# yum -y install curl openssh-server openssh-clients postf
ix cronie policycoreutils-python
#启动postfix服务并设置开机自启
[[email protected] ~]# systemctl restart postfix
[[email protected] ~]# systemctl enable postfix
#下载gitlab的rpm包。这里是本地上传的
[[email protected] ~]# cd /usr/src/
[[email protected] src]# ls
debug  gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm  kernels
[[email protected] src]# rpm -ivh gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm
警告:gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm: 头V4 RSA/SHA1 Signature, ** ID f27eab47: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:gitlab-ce-11.2.1-ce.0.el7        ################################# [100%]
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
#修改配置文件
......
external_url 'http://gitlab.example.com'
#此行改为gitlab服务的ip或者域名
#修改为
external_url 'http://192.168.118.222'
......
#重启配置文件和gitlab
[[email protected] ~]# gitlab-ctl reconfigure
[[email protected] src]# gitlab-ctl restart
ok: run: alertmanager: (pid 26244) 0s
ok: run: gitaly: (pid 26258) 1s
ok: run: gitlab-monitor: (pid 26271) 0s
ok: run: gitlab-workhorse: (pid 26288) 1s
ok: run: logrotate: (pid 26301) 0s
ok: run: nginx: (pid 26308) 0s
ok: run: node-exporter: (pid 26316) 1s
ok: run: postgres-exporter: (pid 26323) 0s
ok: run: postgresql: (pid 26407) 1s
ok: run: prometheus: (pid 26415) 0s
ok: run: redis: (pid 26430) 1s
ok: run: redis-exporter: (pid 26434) 0s
ok: run: sidekiq: (pid 26445) 0s
ok: run: unicorn: (pid 26457) 0s
#查看当前gitlab版本
[[email protected] src]# head -1 /opt/gitlab/version-manifest.txt
gitlab-ce 11.2.1
[[email protected] src]# ss -antl
State       Recv-Q Send-Q      Local Address:Port        Peer Address:Port
LISTEN      0      100             127.0.0.1:25                     *:*
LISTEN      0      128                     *:8060                   *:*
LISTEN      0      128             127.0.0.1:9121                   *:*
LISTEN      0      128             127.0.0.1:9090                   *:*
LISTEN      0      128             127.0.0.1:9187                   *:*
LISTEN      0      128             127.0.0.1:9093                   *:*
LISTEN      0      128             127.0.0.1:9100                   *:*
LISTEN      0      128             127.0.0.1:9229                   *:*
LISTEN      0      128             127.0.0.1:8080                   *:*
LISTEN      0      128                     *:80                     *:*
LISTEN      0      128             127.0.0.1:9168                   *:*
LISTEN      0      128             127.0.0.1:8082                   *:*
LISTEN      0      128             127.0.0.1:9236                   *:*
LISTEN      0      128                     *:22                     *:*
LISTEN      0      100                   ::1:25                    :::*
LISTEN      0      128                    :::9094                  :::*
LISTEN      0      128                   ::1:9168                  :::*
LISTEN      0      32                     :::21                    :::*
LISTEN      0      128                    :::22                    :::*
#设置管理员密码
[[email protected] src]# gitlab-rails console production
-------------------------------------------------------------------------------------
 GitLab:       11.2.1 (2d6c1c6)
 GitLab Shell: 8.1.1
 postgresql:   9.6.8
-------------------------------------------------------------------------------------
Loading production environment (Rails 4.2.10)
#id为1的是超级管理员
irb(main):001:0> user = User.where(id: 1).first
#密码至少是8个字符
=> #<User id:1 @root>
irb(main):002:0> user.password = '123456789'
=> "123456789"
irb(main):003:0> user.save!    #保存修改,若无问题将返回true
Enqueued ActionMailer::DeliveryJob (Job ID: 2f2e1e2d-cb7a-4d8e-8f3e-4f34cc51ca02) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", gid://gitlab/User/1
=> true
irb(main):004:0> exit

在浏览器*问gitlab服务器的ip地址
版本控制gitlab
版本控制gitlab
创建用户
版本控制gitlab
普通用户登录
版本控制gitlab
创建haha项目
版本控制gitlab
创建组
版本控制gitlab
将用户加入组
版本控制gitlab
查看已加入用户的组
版本控制gitlab
将用户加入到项目
版本控制gitlab
查看用户已添加到项目
版本控制gitlab
查看设置的用户,项目和组
版本控制gitlab