“Linux系统部署Git仓库(本地版)”的版本间的差异

来自CloudWiki
跳转至: 导航搜索
挂载CentOS-7-x86_64-DVD-1511.iso
 
(未显示2个用户的2个中间版本)
第1行: 第1行:
 +
==所需软件==
 +
 
==服务器端==
 
==服务器端==
  
==挂载CentOS-7-x86_64-DVD-1511.iso==
+
===挂载CentOS-7-x86_64-DVD-1511.iso===
  
 
[root@controller ~]# mkdir /mnt/centos
 
[root@controller ~]# mkdir /mnt/centos
  
[root@controller ~]# mount -o loop /dev/sr1 /mnt/centos(此命令没有任何输出,如果有输出就说明发生了错误)
+
[root@controller ~]# mount -o loop /dev/sr0 /mnt/centos(此命令没有任何输出,如果有输出就说明发生了错误)
  
 
[root@controller ~]# ls /mnt/centos
 
[root@controller ~]# ls /mnt/centos
第12行: 第14行:
  
 
EFI              GPL  isolinux  Packages  RPM-GPG-KEY-CentOS-7  TRANS.TBL  
 
EFI              GPL  isolinux  Packages  RPM-GPG-KEY-CentOS-7  TRANS.TBL  
 +
 +
===配置yum===
 +
 +
cd /etc/yum.repos.d
 +
 +
[root@controller yum.repos.d]# vi local.repo
 +
 +
<nowiki>[centos]
 +
 +
name=centos
 +
 +
baseurl=file:///mnt/centos
 +
 +
gpgcheck=0
 +
 +
enabled=1</nowiki>
 +
 +
[root@localhost yum.repos.d]# yum repolist
 +
 +
<nowiki>Loaded plugins: fastestmirror, langpacks
 +
Loading mirror speeds from cached hostfile
 +
centos/primary_db                                          | 2.8 MB  00:03
 +
repo id                              repo name                            status
 +
centos                              centos                              3,723
 +
repolist: 3,723</nowiki>
  
 
===安装Git===
 
===安装Git===

2019年5月29日 (三) 02:38的最新版本

所需软件

服务器端

挂载CentOS-7-x86_64-DVD-1511.iso

[root@controller ~]# mkdir /mnt/centos

[root@controller ~]# mount -o loop /dev/sr0 /mnt/centos(此命令没有任何输出,如果有输出就说明发生了错误)

[root@controller ~]# ls /mnt/centos

CentOS_BuildTag EULA images LiveOS repodata RPM-GPG-KEY-CentOS-Testing-7

EFI GPL isolinux Packages RPM-GPG-KEY-CentOS-7 TRANS.TBL

配置yum

cd /etc/yum.repos.d

[root@controller yum.repos.d]# vi local.repo

[centos]

name=centos

baseurl=file:///mnt/centos

gpgcheck=0

enabled=1

[root@localhost yum.repos.d]# yum repolist

Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
centos/primary_db                                          | 2.8 MB   00:03
repo id                              repo name                            status
centos                               centos                               3,723
repolist: 3,723

安装Git

yum install git -y

创建Git用户并设置密码(000000)

useradd git
passwd git

创建仓库

创建仓库

su - git
mkdir solo.git
cd solo.git
git --bare init

客户端

客户端一般指开发者用的git节点 以及持续集成中Jenkins所在的服务器

配置免密登录

远程访问仓库

访问创建的这个仓库

[git@localhost solo.git]$ cd ~
[git@localhost ~]$ git clone git@10.0.0.30:/home/git/solo.git
Cloning into 'solo'...
The authenticity of host '10.0.0.30 (10.0.0.30)' can't be established.
ECDSA key fingerprint is SHA256:RD84aAyqeq7pOdIdHHxVnm11Lds1BB4oLcM8AJblbVI.
ECDSA key fingerprint is MD5:4d:90:d2:5f:7d:01:39:da:c8:60:47:96:07:d1:f5:cd.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.0.0.30' (ECDSA) to the list of known hosts.
git@10.0.0.30's password:
warning: You appear to have cloned an empty repository.
[git@localhost ~]$ ls
solo  solo.git
[git@localhost ~]$ ls solo
[git@localhost ~]$ ls solo.git
branches  config  description  HEAD  hooks  info  objects  refs

此时,需要的一个软件已经齐备,拍摄一下快照吧!

参考文档:[1]https://blog.51cto.com/lizhenliang/2159817