centos git服务器搭建配置
安装git
$ yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel $ yum install git
创建用户
$ groupadd git
$ adduser git -g git
设置权限
$ cd /home/git/ $ mkdir .ssh $ chmod 700 .ssh $ touch .ssh/authorized_keys $ chmod 600 .ssh/authorized_keys
$ cd /home
$ mkdir gitrepo
$ chown git:git gitrepo/ $ cd gitrepo $ git init --bare hello.git Initialized empty Git repository in /home/gitrepo/hello.git/
$ chown -R git:git hello.git
$ git clone git@192.168.0.218:/home/gitrepo/hello.git
配置ssh免密码登录
/etc/ssh/sshd_config
找到以下内容,并去掉注释符”#“
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
找到以下内容,并去掉注释符”#“
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
重启ssh
ssh-keygen -t rsa
把公钥放到服务器中
~/.ssh/authorized_keys
posted on
2017-07-11 16:38
梦de河流 阅读(
...) 评论(
...)
编辑
收藏