环境:服务器端CentOS7 客户端Windows

1.服务器端

   1)安装Git yum -y install git

   2)新增git账户,用于管理git  adduser git ;passwd git

 3)初始化git仓库(选择/src/git/test.git作为git仓库):git init --bare test.git;chown git:git test.git

2.客户端

   1)安装windows git客户端

   2)$git clone git@ip:/src/git/test.git (需要输入git账号和密码)

3.创建公钥,免账号密码输入

   1)windows在用户主目录下,看看有没有.ssh目录,复制id_rsa.pub里面内容;如果没有,打开Shell(Windows下打开Git Bash),创建SSH Key:

    $ ssh-keygen -t rsa -C  "邮箱"

   2)Git服务器打开RSA认证(/etc/ssh/sshd_config)

    RSAAuthentication yes 

    PubkeyAuthentication yes 

    AuthorizedKeysFile  .ssh/authorized_keys

   3)把客户端的id_rsa.pub内容粘贴在.ssh/authorized_keys文件中(在/home/git下创建.ssh目录,然后创建authorized_keys文件)

    


posted on 2016-08-11 21:33  Lorryrui  阅读(123)  评论(0编辑  收藏  举报