server side
安装 git-core, openssh-server, openssh-client
sudo apt-get install git-core
sudo apt-get install openssh-server
sudo apt-get install openssh-client添加一个git用户
sudo adduser git切换到git用户
su git创建.ssh目录和authorized_keys文件
cd
mkdir .ssh
cd .ssh
touch authorized_keys
chmod 700 /home/git/.ssh/
chmod 600 /home/git/.ssh/authorized_keys初始化一个不包含工作目录的仓库
cd
mkdir pro.git
cd pro.git
git –bare init
client side
产生ssh key
ssh-keygen -t rsa拷贝~/.ssh/id_rsa.pub到server side
server side
拷贝id_rsa.pub内容到authorized_keys
cat id_rsa.pub >> ~/.ssh/authorized_keys
client side
测试ssh连接
ssh git@serverip建立本例仓库
mkdir pro_git
cd pro_git
git init本地仓库推送到Server side
git config –global user.email “wangyang@irisking.com”
git config –global user.name “wangyang”
touch test.txt
git add test.txt
git commit -m ‘first’
git remote add origin git@serverip:/home/git/pro.git
git push origin mastergit clone
git clone git@10.2.10.240:/home/git/6.0_git