1.安装git

yum install –y git

2.服务器创建git账户

useradd git
passwd git

3.服务器git打开RSA认证 进入 /etc/ssh目录,编辑sshd_config,打开以下三个配置的注释,如无则添加:

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

保存并重启sshd服务.

/etc/rc.d/init.d/sshd restart

4.在 /home/git下创建目录.ssh

cd /home/git
mkdir .ssh

然后更改.ssh的所有者和用户组为git:

chown –R git:git .ssh

5.将客户端公钥导入服务器端 /home/git/.ssh/authorized_keys文件

cd /home/git/.ssh
touch authorized_keys
vi authorized_keys

把客户端公钥粘贴到这个文件. 保存退出.