linux 安装配置git仓库

1、安装git

yum install git

2、添加git用户和git用户组

useradd git
设置密码
passwd git

3、创建git仓库目录 我放在/var/gitdata/

cd /var
mkdir gitdata

cd gitdata

4、创建裸仓库

git init --bare test.git

5、修改仓库所有者和赋予权限

chown -R git:git test.git
chmod -R 775 test.git
6、客户端clone 远程仓库

git clone [email protected]:/var/gitdata/test.git  其中192.168.84.128就是服务器ip地址

8、配置客户端每次提交免密输入

服务端打开RSA认证

进入 /etc/ssh 目录,编辑 sshd_config,打开以下三个配置的注释:
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

由 AuthorizedKeysFile 得知公钥的存放路径是 .ssh/authorized_keys,实际上是 $Home/.ssh/authorized_keys,由于管理 Git 服务的用户是 git,所以实际存放公钥的路径是 /home/git/.ssh/authorized_keys

注意:centos7.4之后没有RSAAuthentication没有这个配置了,可以忽略,已经是默认开启了的

9、重启sshd
systemctl restart sshd

10、在/home/git/下创建

你可能感兴趣的:(运维,git,服务器)