服务器端配置

1、mkdir repos     创建库

2、groupadd git-rw  创建用户组

3、useradd -g git-rw user1  创建组用户

4、git init --bare git_server.git  服务器上创建一个祼仓库

5、groups yjb      查看帐号所属组

6、useradd -g git-rw git

7、mkdir /home/git/.ssh

8、touch /home/git/.ssh/authorized_keys 

9、scp .ssh/id_rsa.pub root@10.10.10.203:/home    客户端使用scp将公钥上传到服务器

10、cat id_rsa.pub >> git/.ssh/authorized_keys

 11、chsh -s $(command -v git-shell) git    禁止git用户ssh登录

修改前:

cat /etc/passwd | grep git

git:x:503:501::/home/git:/bin/bash

修改后:

cat /etc/passwd | grep git
git:x:503:501::/home/git:/usr/bin/git-shell

12、

原文地址:https://www.cnblogs.com/muyiyang/p/6911474.html