1、安装git
yum install git -y
2、创建git账户
useradd git
passwd git
3、用户证书导入
需要登录的用户的公钥,就是他们自己的id_rsa.pub文件,把所有公钥导入到/home/git/.ssh/authorized_keys文件里,一行一个
4、初始化git仓库
git init --bare sample.git
5、用户clone
git clone git@server:/srv/sample.git
Cloning into 'sample'...
warning: You appear to have cloned an empty repository.
6、修改仓库用户
chown -R git:git sample.git
7、正常使用
正常push和pul仓库
如有问题欢迎留言和私信,或联系qq:838648292