搭建GIT服务器
(1)安装Git
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel
yum install git
(2)创建一个git用户组和用户
[root@localhost ~]# groupadd git
[root@localhost ~]# useradd git -g git
(3)创建证书登录
收集所有需要登录的用户的公钥,公钥位于id_rsa.pub文件中,把我们的公钥导入到/home/git/.ssh/authorized_keys文件里,一行一个。
[root@localhost ~]# cd /home/git/
[root@localhost git]# mkdir .ssh
[root@localhost git]# chmod 755 .ssh
[root@localhost git]# touch .ssh/authorized_keys
[root@localhost git]# chmod 644 .ssh/authorized_keys
(4)初始化Git仓库
[root@localhost home]# mkdir gitrepo
[root@localhost home]# chown git:git gitrepo/
[root@localhost home]# cd gitrepo/
[root@localhost gitrepo]# git init --bare runoob.git
Initialized empty Git repository in /home/gitrepo/runoob.git/
[root@localhost gitrepo]# ls
runoob.git
[root@localhost gitrepo]# chown -R git:git runoob.git
(5)克隆仓库
[root@localhost ~]# git clone git@192.168.1.69:/home/gitrepo/runoob.git