07.安装及使用gitlub
博客为日常工作学习积累总结:
1.安装gitlub
sudo yum install -y curl policycoreutils-python openssh-server openssh-clients
- sudo systemctl enable sshd
 - sudo systemctl start sshd
 - sudo yum install postfix
 
- sudo systemctl enable postfixsudo systemctl start postfix
 
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm
rpm -ivh gitlab-ce-10.0.0-ce.0.el7.x86_64.rpm
修改配置文件:
[root@git ~]# vim /etc/gitlab/gitlab.rb
13 external_url 'http://192.168.50.184'
[root@git ~]# gitlab-ctl reconfigure
访问:http://192.168.50.184/
设置密码:*****
设置账号:root
2.命令练习
查看运行的组件
gitlab-ctl start
gitlab-ctl stop
gitlab-ctl restart
gitlab-ctl show-config
[root@git ~]# gitlab-ctl status
run: gitaly: (pid 17810) 984s; run: log: (pid 17480) 1043s
run: gitlab-monitor: (pid 17847) 983s; run: log: (pid 17697) 1013s
run: gitlab-workhorse: (pid 17824) 984s; run: log: (pid 17545) 1037s
run: logrotate: (pid 17607) 1025s; run: log: (pid 17606) 1025s
run: nginx: (pid 17571) 1031s; run: log: (pid 17570) 1031s
run: node-exporter: (pid 17676) 1019s; run: log: (pid 17675) 1019s
run: postgres-exporter: (pid 17905) 982s; run: log: (pid 17761) 999s
run: postgresql: (pid 17305) 1082s; run: log: (pid 17304) 1082s
run: prometheus: (pid 17855) 983s; run: log: (pid 17736) 1005s
run: redis: (pid 17233) 1090s; run: log: (pid 17232) 1090s
run: redis-exporter: (pid 17720) 1008s; run: log: (pid 17719) 1008s
run: sidekiq: (pid 17462) 1046s; run: log: (pid 17461) 1046s
run: unicorn: (pid 17423) 1052s; run: log: (pid 17422) 1052s
查看组件日子:
[root@git ~]# gitlab-ctl tail nginx
[root@git ~]# cd /var/log/gitlab/
3.管理员界面操作
小扳手的图标:admin area
第一步:创建用户组:
创建项目组java
第二步:创建用户:
创建用户pm,dev1,dev2
第三步:创建项目:
创建项目app1
第四步:配置公钥:linux系统拉取代码配置方式
[root@git ~]# ssh-keygen
配置公钥:一个公钥全网只能一个用户使用
在用户属性里面配置
[root@git~]# cd .ssh/
[root@git .ssh]# cat id_rsa.pub
用所属者新建
创建文件新建分支:
用dev1操作:
git clone git@192.168.50.184:java/app1.git
进入克隆的项目app1里面git pull拉取代码
[root@git app1]# ls
[root@git app1]# git pull
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From 192.168.50.184:java/app1
 * [new branch]      master     -> origin/master
第五步:配置公钥:windows系统拉取代码配置方式
安装bash shell Git-2.15.1.2-64-bit.exe
到目录右键选择git bash here F:\git
ssh-keygen
加到dev2里面,配置公钥,
git clone git@192.168.50.184:java/app1.git
第六步:配置deploy_keys给jenkins用:
第七步:pm新建里程碑分配开发任务:
第八步:dev1接受开发任务准备开发:
新建分支:创建分支后就会切换
[root@git app1]# git checkout -b shouye
Switched to a new branch 'shouye'
[root@git app1]# git status
On branch shouye
nothing to commit, working tree clean
写页面:
[root@git app1]# vim index.html
<h1>welcome to beijing</h1>
提交到本机仓库:
[root@git app1]# git add .
[root@git app1]# git commit -m "shouye"
[shouye fbee400] shouye
 1 file changed, 1 insertion(+)
 create mode 100644 index.html
提交到远程仓库:分支名
[root@git app1]# git push origin shouye
Counting objects: 3, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 296 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: 
remote: To create a merge request for shouye, visit:
remote:   http://192.168.50.184/java/app1/merge_requests/new?merge_request%5Bsource_branch%5D=shouye
remote: 
To 192.168.50.184:java/app1.git
 * [new branch]      shouye -> shouye
pm界面操作将首页分支merge到master分支
开发第二个工作任务
切换到主分支更新代码
[root@git app1]# git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
[root@git app1]# git pull
remote: Counting objects: 1, done.
remote: Total 1 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (1/1), done.
From 192.168.50.184:java/app1
   c404246..c99e8c7  master     -> origin/master
Updating c404246..c99e8c7
Fast-forward
 index.html | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 index.html
创建news分支
[root@git app1]# git checkout -b news
Switched to a new branch 'news'
[root@git app1]# vim news.html
news center
可自动关闭issues
[root@git app1]# git add .
[root@git app1]# git commit -m "close #2"
[news 30bf4e7] close #2
 1 file changed, 1 insertion(+)
 create mode 100644 news.html
[root@git app1]# git status
On branch news
nothing to commit, working tree clean
[root@git app1]# git merge news
Already up-to-date.
[root@git app1]# git log
[root@git app1]# git push origin master
Everything up-to-date
开发的角色不能将代码推送到主分支
[root@git app1]# git status 
On branch news
nothing to commit, working tree clean
[root@git app1]# git push origin news
[root@git ~]# mkdir -p /data/backups/gitlab
修改代码备份的位置
272 gitlab_rails['backup_path'] = "/data/backups/gitlab"
放开代码备份天数
280 gitlab_rails['backup_keep_time'] = 604800
从新加载配置文件
[root@git ~]# gitlab-ctl reconfigure
重启gitlab
[root@git ~]# gitlab-ctl restart
给备份目录加git权限
[root@git ~]# ll /data/backups/
total 0
drwx------ 2 git root 6 Apr 12 16:12 gitlab
[root@git ~]# chown -R git.git /data/backups/gitlab
[root@git ~]# ll /data/backups/                    
total 0
drwx------ 2 git git 6 Apr 12 16:12 gitlab
定时任务crontab中加入
[root@git ~]# crontab -e
no crontab for root - using an empty one
0 2 * * * /usr/bin/gitlab-rake gitlab:backup:create
[root@git ~]# ls /data/backups/gitlab/
1555057701_2019_04_12_10.0.0_gitlab_backup.tar
[root@git ~]# date -d @1555057701
Fri Apr 12 16:28:21 CST 2019
恢复备份数据:
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
gitlab-rake gitlab:backup:restore BACKUP=
[root@git ~]# gitlab-ctl stop unicorn
ok: down: unicorn: 1s, normally up
[root@git ~]# gitlab-ctl stop sidekiq
ok: down: sidekiq: 0s, normally up
[root@git ~]# gitlab-rake gitlab:backup:restore BACKUP=1555057701_2019_04_12_10.0.0
两个yes恢复OK
[root@git ~]# ls /var/opt/gitlab/git-data/repositories/java/
app1.git
重启gitlab
[root@git ~]# gitlab-ctl restart
配置邮件及ldap认证:
https://blog.csdn.net/chanjingyue/article/details/80523600

gitlab汉化:
https://blog.csdn.net/qq_40025218/article/details/81360794
07.安装及使用gitlub的更多相关文章
- 指导手册 07 安装配置HIVE
		
指导手册 07 安装配置HIVE 安装环境及所需安装包: 1.操作系统:centos6.8 2.四台虚拟机:master :10.0.2.4, slave1:10.0.2.5,slave2:10. ...
 - CentOS7安装OpenStack(Rocky版)-07.安装horizon服务组件(控制节点dashboard)
		
在上一篇文章分享了neutron网络服务的安装配置,本文分享openstack的horizon(dashboard)web界面管理服务,方便在浏览器操作 ---------------------- ...
 - Liunx 安装 Mysql 5.7
		
#[安装 Mysql 5.7] # 00.系统目录说明# 安装文件下载目录:/data/software# Mysql目录安装位置:/usr/local/mysql# 数据库保存位置:/data/my ...
 - centos6.8上安装paramiko
		
author : headsen chen date: 2018-10-07 17:06:07 # 安装gcc,python-devel yum -y install python-devel ...
 - npm 的安装与使用
		
创建: 2019/04/06 完成: 2019/04/07 安装 npm写在node.js里, 故安装node.js即可 https://nodejs.org/en/download/ 确认是否安装 ...
 - k8s环境搭建--基于kubeadm方法
		
环境 master node: 数量 1, 系统 ubuntu 16.04_amd64 worker node: 数量 1, 系统 ubuntu 16.04_amd64 kubernetes 版本: ...
 - 黑马程序员_java基础笔记(01)...java的环境搭建
		
—————————— ASP.Net+Android+IOS开发..Net培训.期待与您交流!—————————— JavaSE(Java Standard Edtion java标准版)技术概况 ...
 - 0002 Django工程创建
		
1 创建一个目录,用于专门存放Django工程的虚拟环境 PyCharm默认虚拟环境在工程内,从而导致打包的时候,会把虚拟环境一起打包. 同时,虚拟环境中的插件较多,一个工程创建了一个虚拟环境,以后, ...
 - 02 Django虚拟环境搭建
		
01 创建虚拟环境目录 该目录用于存放所有虚拟环境. cd / mkdir venv cd venv 02 创建当前项目的虚拟环境 virtualenv --python=/usr/bin/pytho ...
 
随机推荐
- linux php多版本
			
ecshop还非php5.2 解压 gzip -cd php-5.2.14-fpm-0.5.14.diff.gz | patch -d php-5.2.14 -p1 打上php-fpm补丁再安装php ...
 - 07_zookeeper的客户端工具curator_基本api
			
[zk原生api的不足之处] * 不能自动超时重连,需要手动操作 * watcher事件注册一次后就会失效 * 不支持递归创建节点 [ Apache curator ] * 解决了watcher的注册 ...
 - 常量、变量、数据类型                 搞错N+1次  累死
			
public class hello { /** * * * * * @param args */ public static void main(String[] args) { String _$ ...
 - Python学习系列-----第二章 操作符与表达式
			
2.1 数学运算和赋值的简便方法 例如: 2.2 优先级 在python中运算符有优先级之分,高优先级的运算符先执行,低优先级的运算符后执行.下面是运算符优先级:(同一行的运算符具有相同的优先级) 2 ...
 - 在线官网Spring Initializr 或 IntelliJ IDEA 快速搭建springboot项目
			
Spring Boot是由Pivotal团队提供的全新框架,设计目的是用来简化新Spring应用的初始搭建以及开发过程.它主要推崇的是'消灭配置’,实现零配置. 那么,如何快速新建一个一个spring ...
 - git下的团队合作模型及git基础知识汇集
			
https://www.atlassian.com/git/tutorials/syncing/git-fetch Syncing svn使用单个中央库来作为开发者之间沟通的桥梁,而协同合作是通过在开 ...
 - 针对通过 SSH 连接到 Azure Linux VM 时发生的失败、错误或被拒绝问题进行故障排除
			
尝试连接到 Linux 虚拟机 (VM) 时,有多种原因可能会导致安全外壳 (SSH) 错误.SSH 连接失败或被拒绝. 本文帮助用户找出原因并更正问题. 可以使用 Azure 门户.Azure CL ...
 - STL算法分类记忆
			
STL算法主要是我们强大的标准库中以迭代器或数值或函数对象为参数预先定义好的一系列算法操作. 在STL算法分类中首先要提的就是两个普遍存在的后缀: _if _copy 其中这两个后缀的作用分别是:一. ...
 - .net通过代码发送邮件
			
关键代码: 需要引用命名空间: using System.Net.Mail;using System.Net; MailMessage mailObj = new MailMessage(); mai ...
 - 关于WEB-INF目录下无法访问webapp下的css等静态文件
			
第一种方法: <!-- 输出为项目根目录,即webapp--> <c:set value="${pageContext.request.contextPath}" ...