git server配置

1、安装git

yum install git-core

2、新增git用户,该用户只能ssh连接但是不能登录

sudo adduser -m git

vim /etc/passwd

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

修改为

git:x:501:501::/home/git:/usr/bin/git-shell

3、创建资源库

git init --bare qa-core.git
chown -R git:git qa-core.git/

4、在/home/git目录下将开发人员的ssh公钥写入到authorized_keys

cat ~/git_pub/id_rsa_sz_zhaolei.pub >> /home/git/.ssh/authorized_keys

猜你喜欢

转载自zhaoleije.iteye.com/blog/2215027