关键词:
gitlab版本控制
[TOC]
1.版本控制介绍
定义
版本控制是指对软件开发过程中各种代码程序、配置文件及说明文档等文件变更的管理,是软件配置管理的核心思想之一。
功能
- 追踪文件的变更
- 并行开发
常用的版本控制工具:
- gitlab
- suversion
2.gitlab部署
关闭防火墙以及SELINUX
[[email protected] ~]# systemctl stop firewalld
[[email protected] ~]# systemctl disable firewalld
[[email protected] ~]# sed -ri ‘s/^(SELINUX=).*/1disabled/g‘ /etc/selinux/config
[[email protected] ~]# setenforce 0
配置yum源
[[email protected] ~]# cd /etc/yum.repos.d/
[[email protected] yum.repos.d]# curl -o 163.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1572 100 1572 0 0 279 0 0:00:05 0:00:05 --:--:-- 382
[[email protected] yum.repos.d]# sed -i ‘s/$releasever/7/g‘ /etc/yum.repos.d/163.repo
[[email protected] yum.repos.d]# sed -i ‘s/^enabled=.*/enabled=1/g‘ 163.repo
[[email protected] yum.repos.d]# yum -y install epel-release
安装git
[[email protected] ~]# yum -y install git
安装依赖包
[[email protected] ~]# yum -y install curl openssh-server openssh-clients postfix cronie policycoreutils-python
启动postfix服务并设置开机自启动
[[email protected] ~]# systemctl restart postfix
[[email protected] ~]# systemctl enable postfix
下载gitlab的rmp包
[[email protected] ~]# cd /usr/src
[[email protected] src]# ls
debug kernels
[[email protected] src]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/y
--2018-09-04 02:35:08-- https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/y
Resolving mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... um/el7/gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm101.6.8.193, 2402:f000:1:408:8100::1
Connecting to mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.8.193|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2018-09-04 02:35:09 ERROR 404: Not Found.
[[email protected] src]# um/el7/gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm
-bash: um/el7/gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm: No such file or directory
[[email protected] src]# cd
[[email protected] ~]# cd /usr/src
[[email protected] src]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm
--2018-09-04 02:35:59-- https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm
Resolving mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.8.193, 2402:f000:1:408:8100::1
Connecting to mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.8.193|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 444944490 (424M) [application/x-redhat-package-manager]
Saving to: ‘gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm’
100%[================================================================================>] 444,944,490 5.76MB/s in 71s
2018-09-04 02:37:10 (5.96 MB/s) - ‘gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm’ saved [444944490/444944490]
[[email protected] src]# ls
debug gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm kernels
安装gitlab
[[email protected] src]# rpm -ivh gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm
warning: gitlab-ce-11.2.1-ce.0.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID f27eab47: NOKEY
Preparing... ################################# [100%]
Updating / installing...
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
修改配置文件
[[email protected] ~]# vim /etc/gitlab/gitlab.rb
...
...
## GitLab URL
##! URL on which GitLab will be reachable.
##! For more details on configuring external_url see:
##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
external_url ‘http://192.168.24.130‘ 修改此处为自己的IP或域名
## Roles for multi-instance GitLab
##! The default is to have no roles enabled, which results in GitLab running as an all-in-one instance.
##! Options:
##! redis_sentinel_role redis_master_role redis_slave_role geo_primary_role geo_secondary_role
##! For more deatils on each role, see:
##! https://docs.gitlab.com/omnibus/roles/README.html#roles
##!
# roles [‘redis_sentinel_role‘, ‘redis_master_role‘]
...
...
重新加载配置文件并重启gitlab
[[email protected] ~]# gitlab-ctl reconfigure
[[email protected] ~]# gitlab-ctl restart
查看当前gitlab版本
[[email protected] ~]# head -1 /opt/gitlab/version-manifest.txt
gitlab-ce 11.2.1
设置管理员密码
[[email protected] ~]# 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)
irb(main):001:0> user = User.where(id: 1).first //id为1是超级管理员
=> #<User id:1 @root>
irb(main):002:0> user.password = ‘linfan123‘//密码至少8个字符
=> "linfan123"
irb(main):003:0> user.save! //保存修改,无问题则返回true
Enqueued ActionMailer::DeliveryJob (Job ID: feb0d3ec-534f-4e87-9dad-ceafbae40a53) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", gid://gitlab/User/1
=> true
irb(main):004:0> exit //退出
gitlab管理
在浏览器输入IP或域名地址
进去后创建groups users projects 选择Settings下的Members添加项目的成员或组
gitlab常用管理操作
- 项目管理(通常只是创建新项目)
- 创建成员组(真对某个项目创建一个成员组)
-
用户管理(此用户是gitlab用户而非系统用户)
- 来了新员工 为其添加gitlab用户
- 员工离职,将其gitlab用户禁用或删除
源码部署gitlab版本控制系统(代码片段)
本文章适用于需要自建gitlab代码管理系统环境一.部署前环境准备1.安装软件包及版本要求1.Ubuntu/Debian/CentOS/RHEL2.ruby2.4+3.git2.7.2+4.go1.0.0+5.redis3.2+6.node8.0+7.MySQL(5.6+)orPostgreSQ(9.4+) 查看详情
git&gitlab版本控制系统(代码片段)
常见版本管理工具SVN 集中式的版本控制系统,只有一个中央数据仓库,如果中央数据仓库挂了或者不可访问,所有的使用者无法使用SVN.无法进行提交或备份文件。Git 分布式的版本控制系统,在每个使用者电脑上就有一... 查看详情
gitlab(代码片段)
1.什么是gitlabgitlab是一个开源分布式版本控制系统开发语言为ruby功能:管理项目代码,版本控制,代码复用与查找2.gitlab和github的不同1.github分布在线代码托管仓库,个人版本可直接在线免费使用,企业版本收费且需要服务器安... 查看详情
gitlab的安装及使用(代码片段)
GitLab的安装及使用前言GitLab安装GitLab使用SourceTree管理客户端软件前言Git是一款免费、开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目。Git是一个开源的分布式版本控制系统,可以有效、高速的处理... 查看详情
gitlab的安装及使用(代码片段)
GitLab的安装及使用前言GitLab安装GitLab使用SourceTree管理客户端软件前言Git是一款免费、开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目。Git是一个开源的分布式版本控制系统,可以有效、高速的处理... 查看详情
gitlab10.5版本的部署使用及汉化(代码片段)
概述讲义:GitLab是一个开源版本管理系统,是集代码托管,测试,部署于一体的开源git仓库管理软件,可通过web界面来进行访问公开的或私人项目。与Github类似,GitLab能够浏览代码,管理缺陷和注释。可以管理团队对仓库的访问... 查看详情
分布式版本控制系统-gitlab搭建(代码片段)
...们需要搭建公司内部的Git版本控制系统,开源免费的GitLab成为了我们的选择。本文详细讲解了分布式版本控制系统GitLab的搭建、用户配置以及如何进行版本控制。目录写在前面一、什么是Git二、安装GitLab2.1、安装部署2.2、添... 查看详情
docker安装gitlab(代码片段)
概述Gitlab是一个开源分布式版本控制系统,由Ruby开发,有管理项目源代码、版本控制、代码复用与查找等功能。搜索Docker镜像dockersearchgitlab这些版本默认都是英文的,但是新版本可以在设置中指定语言为中文,基... 查看详情
gitlab安装,使用,备份,恢复(代码片段)
gitlab安装,使用,备份,恢复git是一个版本控制器在分布式版本控制系统里,客户端并不只提取最新版本的文件快照,而是把代码仓库完整地镜像下来。这么一来,任何一处协同工作用的服务器发生故障,事后都可以用任何一个... 查看详情
gitlab的安装及使用(代码片段)
GitLab的安装及使用前言GitLab安装GitLab使用SourceTree管理客户端软件前言Git是一款免费、开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目。Git是一个开源的分布式版本控制系统,可以有效、高速的处理... 查看详情
gitlab安装(代码片段)
GitLab简介:(1)Git是一个分布式的开源版本控制系统,也就是说,每台客户端都可以充当控制中心,我从本机拉取代码,再提交代码到本机,不需要依赖网络,各自开发各自的(2)Git也可以设置一个服务端,用来合并多台客户端的最... 查看详情
使用docker搭建gitlab版本控制系统
1.GitLab简介GitLab是一款基于git的开源代码仓库系统 GitLab与著名的GitHub最大的区别就是: 允许我们搭建自己的git代码私有仓库,非常方便 2、安装Gitlab 安装Gitlab特别的复杂,因此这里我们使用docker搭建一款Gitlab... 查看详情
gitlab查询当前版本(代码片段)
gitlab-rakegitlab:env:info其实还有很多方法可以参考GitLab的帮助文档:https://docs.gitlab.com/omnibus/README.html 参考:https://stackoverflow.com/questions/21068773/how-to-check-the-version-of-gitlab 查看详情
git版本控制-1.环境配置(代码片段)
配置账号信息登陆Linux服务器设置账号和邮箱gitconfig--globaluser.name"username"gitconfig--globaluser.email"youremail"生成并添加ssh-keyssh-keygen-trsa-C"youremail"一直回车就行,不需要输入任何内容。添加ssh-key到gitlab 查看详情
干货gitlab-11.10.4版本汉化(代码片段)
目录1、YUM安装gitlab-11.10.42、gitlab汉化技能1、YUM安装gitlab-11.10.4下载gitlab-ce的repo[[email protected]~]#curl-shttps://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh|sudobash[[email& 查看详情
gitlab升级(代码片段)
公司gitlab版本过旧,为满足生产环境需要,故升级gitlab8至gitlab11。切记,升级前务必做好数据的备份。备份:gitlab-rakegitlab:backup:create还原备份:gitlab-rakegitlab:backup:restoreBACKUP=备份版本号gitlab不能跨越大版本号,只能升级到当前... 查看详情
gitlab搭建与基本使用(代码片段)
一、git、github、gitlab的区别Git是版本控制系统,Github是在线的基于Git的代码托管服务。GitHub是2008年由RubyonRails编写而成。GitHub同时提供付费账户和免费账户。这两种账户都可以创建公开的代码仓库,只有付费账户可以创建私有的... 查看详情
gitlab搭建个人(或公司)版本控制系统
参考技术A说明:Git,Github,GitLab三者关系。Git-是一款自由和开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目。是LinusTorvalds为了帮助管理Linux内核开发而开发的一个开放源码的版本控制软件。(svn是集中化的版... 查看详情