构建git仓库
adduser -gituser
添加git用户
su - gituser
切换到gituser
mkdir .ssh && chmod 700 .ssh
创建.ssh目录并设置权限
touch .ssh/authorized_keys
创建用户公钥库文件
chmod 600 .ssh/authorized_keys
设置用户公钥库权限
cat id_rsa_pub >> /home/gituser/.ssh/authorized_keys
将用户公钥加入到gituser公钥库
mkdir repo.git
创建git库文件目录
git init --bare repo.git
初始化为纯git仓库
chown -R gituser:gituser repo.git
设置git仓库的用户和组
chmod -R 770 repo.git
设置仓库的读取权限