一、纯GIT:
- 安装:
yum -y install git
- 创建仓库:
mkdir -p /home/lee/git cd /home/lee/git git init --bare test.git
- 客户端检出:
root@192.168.8.81:/home/lee/git/test
二、基于SSH的GIT: - 在服务端打开RSA认证
a. 在文件/etc/ssh/sshd_config中添加下列三行内容:RSAAuthentication yes PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys
b. 创建用于存放客户端公钥的文件
cd /root mkdir .ssh touch .ssh/authorized_keys
- 在客户端创建ssh key
ssh-keygen -t rsa -C "complet@163.com"
- 把客户端生成的公钥导入服务端
scp /root/.ssh/id_rsa.pub root@192.168.8.81:/root/.ssh/authorized_keys
- 在客户端检出:
git clone root@192.168.8.81:/home/lee/git/test.git 本文转自 Lee_吉 博客,原文链接: http://blog.51cto.com/12173069/2046650 如需转载请自行联系原作者