Linux搭建Git服務器
一、寫在前面
1. linux 是 centos6 ;
2. git客戶端是在 win7 64位 系統上;
二、Git服務器搭建步驟
su root
yum install git
groupadd git
useradd git -g git
vi /etc/passwd
***
將 git:x:502:502::/home/git:/bin/bash
修改爲 git:x:502:502::/home/git:/usr/bin/git-shell
***
su git
cd /home/git
mkdir .ssh
chmod 700 .ssh
touch .ssh/authorized_keys
chmod 600 .ssh/authorized_keys
cd .ssh
ssh-keygen -t rsa
su root
cd /home
mkdir gitdeport
chown git:git gitdeport
cd gitdeport
git init --bare runoob.git
chown -R git:git runoob.git
vi /home/git/.ssh/authorized_keys
vi /etc/ssh/sshd_config
*****
StrictModes no
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
****
service sshd restart
git clone [email protected]:/home/gitdeport/runoob.git
****
Cloning into 'runoob'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done.
****