參考資料:http://blog.feehi.com/linux/124.html
1.搭配環境
2.安裝git
3.創建git用戶
4.創建裸庫
5.配置公鑰匙
6.客戶端clone代碼庫
1、搭配環境
服務器:linux Centos-64
虛擬機:VMWare 10.0
服務器git版本:1.71
客戶端git版本:Git bash
測試客戶端:W7-64
2、安裝git

首先通過git --version查看是否已經安裝git,未裝則:
yum -y install git
3、創建git用戶

創建git用戶:
adduser git
切換到git用戶:
su git
4、創建裸庫

在/home/git目錄下創建pro.git裸庫:
git init --bare pro.git
5、配置公匙
首先在客戶端打開bash查詢是否存在公匙:

若不存在公匙,則生成:
ssh-keygen -t rsa

查看密匙:
cat id_rsa.pub

下面我們復制id_rsa.pub里的公鑰到服務器的authorized_keys文件中:
首先建文件夾:

再配置/home/git/.ssh/autoirized_keys

6、客戶端clone代碼庫

warning: LF will be replaced by CRLF in text.txt解決辦法:

git commit:

