1. 版本控制介绍

版本控制是指对软件开发过程中各种程序代码、配置文件及说明文档等文件变更的管理,是软件配置管理的核心思想之一。

版本控制最主要的功能就是追踪文件的变更它将什么时候、什么人更改了文件的什么内容等信息忠实地了记录下来。每一次文件的改变,文件的版本号都将增加。除了记录版本变更外,版本控制的另一个重要功能是并行开发。软件开发往往是多人协同作业,版本控制可以有效地解决版本的同步以及不同开发者之间的开发通信问题,提高协同开发的效率。并行开发中最常见的不同版本软件的错误(Bug)修正问题也可以通过版本控制中分支与合并的方法有效地解决。

具体来说,在每一项开发任务中,都需要首先设定开发基线,确定各个配置项的开发初始版本,在开发过程中,开发人员基于开发基线的版本,开发出所需的目标版本。当发生需求变更时,通过对变更的评估,确定变更的影响范围,对被影响的配置项的版本进行修改,根据变更的性质使配置项的版本树继续延伸或产生新的分支,形成新的目标版本,而对于不受变更影响的配置项则不应发产生变动。同时,应能够将变更所产生的对版本的影响进行记录和跟踪。必要时还可以回退到以前的版本。例如当开发需求或需求变更被取消时,就需要有能力将版本回退到开发基线版本。在曾经出现过的季度升级包拆包和重新组包的过程中,其实就是将部分配置项的版本回退到开发基线,将对应不同需求的不同分支重新组合归并,形成新的升级包版本。

版本控制是软件配置管理的核心功能所有置于配置库中的元素都应自动予以版本的标识,并保证版本命名的唯一性。版本在生成过程中,自动依照设定的使用模型自动分支、演进。除了系统自动记录的版本信息以外,为了配合软件开发流程的各个阶段。还需要定义、收集一些元数据来记录版本的辅助信息和规范开发流程,并为今后对软件过程的度量做好准备。当然如果选用的工具支持,这些辅助数据将能直接统计出过程数据,从而方便软件过程改进活动的进行。对于配置库中的各个基线控制项,应该根据其基线的位置和状态来设置相应的访问权限。一般来说,对于基线版本之前的各个版本都应处于被锁定的状态,如需要对它们进行变更,则应按照变更控制的流程来进行操作。

常用的版本控制工具:

  • gitlab
  • subversion
系统版本 IP
RedHat 8 192.168.152.133

2. gitlab部署

//安装依赖包
[root@master ~]# yum -y install curl openssh-server openssh-clients postfix cronie python3-policycoreutils git//启动postfix服务并设置开机自启
[root@master ~]# systemctl enable --now postfix
Created symlink /etc/systemd/system/multi-user.target.wants/postfix.service → /usr/lib/systemd/system/postfix.service.
[root@master ~]# ss -antl
State   Recv-Q   Send-Q      Local Address:Port       Peer Address:Port
LISTEN  0        128               0.0.0.0:22              0.0.0.0:*
LISTEN  0        100             127.0.0.1:25              0.0.0.0:*
LISTEN  0        128                  [::]:22                 [::]:*
LISTEN  0        100                 [::1]:25                 [::]:*   //安装gitlab,在网上先下好安装包
[root@master ~]# ls
anaconda-ks.cfg  gitlab-ce-13.6.0-ce.0.el8.x86_64.rpm
[root@master ~]# rpm -ivh gitlab-ce-13.6.0-ce.0.el8.x86_64.rpm //下载依赖包
[root@master ~]# yum -y install policycoreutils-python-utils[root@master ~]# rpm -ivh gitlab-ce-13.6.0-ce.0.el8.x86_64.rpm
warning: gitlab-ce-13.6.0-ce.0.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID f27eab47: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...1:gitlab-ce-13.6.0-ce.0.el8        ################################# [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 reconfigureFor a comprehensive list of configuration options please see the Omnibus GitLab readme
https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md//修改配置文件
[root@master ~]# vim /etc/gitlab/gitlab.rb
.....
external_url 'http://192.168.152.133' //将此处设为gitlab的服务器ip地址
.....//重载配置文件并重启gitlab
[root@master ~]# gitlab-ctl reconfigure
[root@master ~]# gitlab-ctl restart
ok: run: alertmanager: (pid 17237) 0s
ok: run: gitaly: (pid 17250) 0s
ok: run: gitlab-exporter: (pid 17265) 1s
ok: run: gitlab-workhorse: (pid 17268) 0s
ok: run: grafana: (pid 17284) 1s
ok: run: logrotate: (pid 17295) 0s
ok: run: nginx: (pid 17304) 1s
ok: run: node-exporter: (pid 17310) 0s
ok: run: postgres-exporter: (pid 17323) 0s
ok: run: postgresql: (pid 17332) 0s
ok: run: prometheus: (pid 17342) 0s
ok: run: puma: (pid 17431) 0s
ok: run: redis: (pid 17436) 1s
ok: run: redis-exporter: (pid 17441) 0s
ok: run: sidekiq: (pid 17449) 0s
[root@master ~]# ss -antl
State  Recv-Q  Send-Q     Local Address:Port     Peer Address:Port
LISTEN 0       1024           127.0.0.1:8080          0.0.0.0:*
LISTEN 0       1024           127.0.0.1:9168          0.0.0.0:*
LISTEN 0       511              0.0.0.0:80            0.0.0.0:*
LISTEN 0       128            127.0.0.1:8082          0.0.0.0:*
LISTEN 0       1024           127.0.0.1:9236          0.0.0.0:*
LISTEN 0       128              0.0.0.0:22            0.0.0.0:*
LISTEN 0       1024           127.0.0.1:3000          0.0.0.0:*
LISTEN 0       100            127.0.0.1:25            0.0.0.0:*
LISTEN 0       511              0.0.0.0:8060          0.0.0.0:*
LISTEN 0       1024           127.0.0.1:9121          0.0.0.0:*
LISTEN 0       1024           127.0.0.1:9090          0.0.0.0:*
LISTEN 0       1024           127.0.0.1:9187          0.0.0.0:*
LISTEN 0       1024           127.0.0.1:9093          0.0.0.0:*
LISTEN 0       1024           127.0.0.1:9100          0.0.0.0:*
LISTEN 0       1024           127.0.0.1:9229          0.0.0.0:*
LISTEN 0       1024               [::1]:9168             [::]:*
LISTEN 0       128                 [::]:22               [::]:*
LISTEN 0       100                [::1]:25               [::]:*
LISTEN 0       1024                   *:9094                *:*  //查看当前的gitlab版本
[root@master ~]# head -1 /opt/gitlab/version-manifest.txt
gitlab-ce 13.6.0


//破解管理员密码
[root@master ~]# gitlab-rails console -e production
--------------------------------------------------------------------------------Ruby:         ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]GitLab:       13.6.0 (6317794da29) FOSSGitLab Shell: 13.13.0PostgreSQL:   11.9
--------------------------------------------------------------------------------
Loading production environment (Rails 6.0.3.3)
irb(main):001:0>
irb(main):002:0> user = User.where(id: 1).first     //id为1的是超级管理员
=> #<User id:1 @root>
irb(main):003:0> user.password = 'lp123456'         //密码必须至少8个字符
=> "lp123456"
irb(main):004:0> user.password = 'lp123456'
=> "lp123456"
irb(main):005:0> user.password_confirmation = 'lp123456'
=> "lp123456"
irb(main):006:0> user.save!
Enqueued ActionMailer::MailDeliveryJob (Job ID: da3a0a07-46de-40d9-8af9-dc1cbddb913c) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", {:args=>[#<GlobalID:0x00007fba9d3e1980 @uri=#<URI::GID gid://gitlab/User/1>>]}
=> true     //保存修改,若无问题将返回true
irb(main):007:0> exit      //退出





  • 设置管理员不验证,新注册用户直接登录









  • 项目管理


//在本机上生成公钥
[root@master ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:yLa6Pv7zCOgGv3dm0v+9B+Z+vDjGfOGfACoWvVR2zrA root@master
The key's randomart image is:
+---[RSA 3072]----+
|                 |
|                 |
|           + .   |
|     . .. o *    |
|      +.So E o   |
|.  . . .o o + .  |
| o. ...o o = = . |
| .o +oB..  .*.B .|
| .o==Oo+o..o=*.+.|
+----[SHA256]-----+
[root@master ~]# cd ..ssh/
bash: cd: ..ssh/: No such file or directory
[root@master ~]# cd .ssh/
[root@master .ssh]# ls
id_rsa  id_rsa.pub
[root@master .ssh]# cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC0ihSsuXufme2+VIB2fTTkfamHLOa65uNSBxSHH37R8WdMKSkskBqMi2rXX4WFKZd+kWvBlUbNAGvyX72V7uGcL9CUOGth6MW8slFwAOSOIGC8+gefQtNUCxhP9isRrOhfn3Z9mIFeNmPl+dQAQy+itWHV/tpbCfAyqmTLcxDp3ZOPCT3f6zuhxxAe6oanWKO0Z73wZRJE9XBw+az+ejKV0wOxWUU6kqkHaq9YWqJBo8pgMvpEyxq7bOTwpNDwRrwY413mUN2Vlo+LEeOBPOU1iE9TH5Lq6d8klrlzw3L1pOpTA9ImN0etK+I6HWYLfst1UCI+WbcFtCPbwR99/7XBW62JePFWUV67oX09d1NFV9ovi73MU4965gxeAF0COad/UsJMLbyISa3NfbVrhE1YQ7KYS6xzgSjqL6j65BLywsEkUuYpDYjUS5BWw5QRwrYumzDShEMq8ny4LWtad+a16boWrHvBIDOALNATs+m7KEmLUEPNHbtyzppk0+Hxois= root@master
//克隆项目
[root@master ~]# git clone http://192.168.152.133/root/runtime.git
Cloning into 'runtime'...
Username for 'http://192.168.152.133': root     //输入用户
Password for 'http://root@192.168.152.133':     //输入密码
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
[root@master ~]# ls
anaconda-ks.cfg  gitlab-ce-13.6.0-ce.0.el8.x86_64.rpm  runtime
[root@master ~]# ls runtime/
README.md
[root@master ~]# cat runtime/README.md
# runtime当你凝视深渊时,深渊也在凝视着你。[root@master ~]#
  • 上传文件
//git 全局设置
[root@master ~]# git config --global user.name root    //设置默认使用的用户
[root@master ~]# git config --global user.eamil root@master.exam //设置默认使用的邮箱//上传现有文件
[root@master ~]# mkdir test/
[root@master ~]# cd test/
[root@master test]# ls
[root@master test]# git init           //初始化为仓库
Initialized empty Git repository in /root/test/.git/     //仓库名为test
[root@master test]# git remote add origin git@192.168.152.133:root/test.git
[root@master test]# vim test.sh
[root@master test]# ls
test.sh
[root@master test]# git add .[root@master test]# git commit -m "Initial commit"  //提交
[master (root-commit) b8ffe24] Initial commit1 file changed, 1 insertion(+)create mode 100644 test.sh[root@master test]# git push -u origin master      //上传

  • 项目管理-用户权限管理





  • 配置中文版web界面

GitLab 版本管理相关推荐

  1. GitLab版本管理

    转载地址:http://www.cnblogs.com/wintersun/p/3930900.html GitLab是利用 Ruby on Rails 一个开源的版本管理系统,实现一个自托管的Git ...

  2. Ubuntu bitnami gitlab 安装

    /*************************************************************************************** Ubuntu bitn ...

  3. 【转发】Git本地服务器搭建及使用详解

    来源:https://www.cnblogs.com/linsanshu/p/5512038.html Git本地服务器搭建及使用 Git是一款免费.开源的分布式版本控制系统.众所周知的Github便 ...

  4. 如何做好一名前端Leader

    如何做好一名前端leader?需要聪明绝顶的智商?还是盖世无双的技术?又或者是滔滔不绝的口才? 一.前言 昨天面试了一家公司,感觉还不错,各方面条件都还ok,他们是需要招一名前端leader,而我则即 ...

  5. Git本地服务器搭建及使用

    Git是一款免费.开源的分布式版本控制系统.众所周知的Github便是基于Git的开源代码库以及版本控制系统,由于其远程托管服务仅对开源免费,所以搭建本地Git服务器也是个较好的选择,本文将对此进行详 ...

  6. 代码版本管理 GitLab介绍

    一.前言 GitLab是利用 Ruby on Rails 一个开源的版本管理系统,实现一个自托管的 Git 项目仓库,可通过 Web 界面进行访问公开的或者私人项目. 它拥有与 Github 类似的功 ...

  7. 为企业搭建Gitlab软件版本管理服务器

    实战:为企业搭建Gitlab软件版本管理服务器 前期准备: 1.把物理内存调到6G,不然后安装时,会内存太低报错. 2.提前上传到gitlab-ce-10.2.3-ce.0.el7.x86_64.rp ...

  8. 版本管理之gitlab实践教程:基础篇(3)

    comment是版本管理中非常重要的内容,尤其是在经年累月的大型项目中,铁打的项目,流水的SE,哪怕只言片语的留下,对后来者问题的对应很多时候都能起到重要作用,这篇文章用来讲解git中如何进行comm ...

  9. 版本管理工具:Gitlab

    与集中式的版本管理工具不同, git采用分布式的版本管理方式. 由于最为广泛使用的git的仓库github只提供public的免费版本,所以更适合开源项目的管理,priavte仓库收费加之数据保留在远 ...

最新文章

  1. 苹果竟放出“流氓” APP
  2. Imageloader3-单例模式
  3. 闲聊Linux内存管理(1)
  4. jQuery Mobile滚动事件
  5. 1流式细胞术荧光比值计算_浅谈流式细胞仪的工作原理和应用
  6. linux系统资格认证,Linux资格认证:Linux操作系统的运行级别
  7. 加密算法使用(三):用用BASE64
  8. linux启动本地远程服务,如何使用SSH在本地控制远程服务器执行命令
  9. Apollo的学习笔记
  10. python中如何去掉重复元素
  11. java gis 矢量数据结构_2.4. 矢量数据结构
  12. python语言实现指纹识别_Python语言之指纹识别是目前最成熟的识别技术!Python能分分钟做出一个来!...
  13. 哲学思考之否定之否定规律
  14. 回调地址没备案_回调地址常见问题及修改方法
  15. libnids中TCP/IP栈实现细节分析——TCP会话重组
  16. python 循环写入excel_用PYTHON将“for”循环的输出写到excel中
  17. 深入浅出Mybatis-改造Cache
  18. 机器人及无人驾驶领域真实人才供需状况如何?企业真正需要什么样的人才?
  19. 【计算机视觉学习一】计算机视觉简述
  20. Correct Sentence

热门文章

  1. EM加血程序(多人版)程序(流星程序集之六)
  2. 魔兽世界WoW注册网站搭建——-Liunx
  3. AFL源码分析之afl-fuzz(学习笔记)(二)
  4. 盘点由中国人开发的编程语言
  5. (AI) 综合案例-渐变图标
  6. 高智商群体的心病,AI能通过望闻问切治愈吗?
  7. Java - 微信小程序授权手机号登录
  8. 油猴的详细安装(google chrome)
  9. 微信小程序 - 答题进度条
  10. linux shred命令,Linux之shred命令彻底粉碎删除文件