轉(zhuǎn)自菜鳥教程
1、安裝Git
$ yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel
$ yum install git
接下來我們
創(chuàng)建一個git用戶組和用戶渔工,用來運行g(shù)it服務(wù):
$ groupadd git
$ useradd git -g git
2八堡、創(chuàng)建證書登錄
收集所有需要登錄的用戶的公鑰,公鑰位于id_rsa.pub文件中楞捂,把我們的公鑰導(dǎo)入到/home/git/.ssh/authorized_keys文件里薄坏,一行一個。
如果沒有該文件創(chuàng)建它:
$ cd /home/git/$ mkdir .ssh
$ chmod 755 .ssh
$ touch .ssh/authorized_keys
$ chmod 644 .ssh/authorized_keys
3寨闹、初始化Git倉庫
首先我們選定一個目錄作為Git倉庫胶坠,假定是/home/gitrepo/runoob.git,在/home/gitrepo目錄下輸入命令:
$ cd /home
$ mkdir gitrepo
$ chown git:git gitrepo/$ cd gitrepo
$ git init --bare runoob.gitInitialized empty Git repository in /home/gitrepo/runoob.git/
以上命令Git創(chuàng)建一個空倉庫繁堡,服務(wù)器上的Git倉庫通常都以.git結(jié)尾沈善。然后,把倉庫所屬用戶改為git:
$ chown -R git:git runoob.git
4帖蔓、克隆倉庫
$ git clone? git@192.168.45.4:/home/gitrepo/runoob.git
Cloning into 'runoob'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done.
192.168.45.4 為 Git 所在服務(wù)器 ip 矮瘟,你需要將其修改為你自己的 Git 服務(wù) ip。
這樣我們的 Git 服務(wù)器安裝就完成塑娇。