安装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 [email protected].168.0.218:/home/gitrepo/hello.git
配置ssh免密码登录
/etc/ssh/sshd_config
找到以下内容,并去掉注释符”#“
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
重启ssh
ssh-keygen -t rsa
把公钥放到服务器中
~/.ssh/authorized_keys
时间: 2024-10-12 05:44:45