一、纯GIT:

  1. 安装:
    yum  -y  install  git
  2. 创建仓库:
    mkdir  -p  /home/lee/git
    cd  /home/lee/git
    git  init  --bare  test.git
  3. 客户端检出:
    root@192.168.8.81:/home/lee/git/test

    Cenos7搭建git服务器
    Cenos7搭建git服务器
    二、基于SSH的GIT:

  4. 服务端打开RSA认证
    a. 在文件/etc/ssh/sshd_config中添加下列三行内容:
    RSAAuthentication yes
    PubkeyAuthentication yes
    AuthorizedKeysFile  .ssh/authorized_keys

    b. 创建用于存放客户端公钥的文件

    cd  /root
    mkdir  .ssh
    touch  .ssh/authorized_keys
  5. 客户端创建ssh key
    ssh-keygen  -t  rsa  -C  "complet@163.com"
  6. 客户端生成的公钥导入服务端
    scp  /root/.ssh/id_rsa.pub  root@192.168.8.81:/root/.ssh/authorized_keys
  7. 客户端检出:
    git  clone  root@192.168.8.81:/home/lee/git/test.git