搭建git服务器仓库
2014-06-14 本文已影响412人
Amrzs
搭建git服务器仓库
from my wp blog
安装git并创建git用户
$ sudo apt-get install git
$ sudo adduser git
添加证书登陆
将登陆用户的公钥id_rsa.pub
文件导入到/home/git/.ssh/authorized_keys
中
初始化git仓库
$ sudo git init --bare sample.git
$ sudo chown -R git:git sample.git
禁用shell登陆
$ vi /etc/passwd
git:x:1001:1001:,,,:/home/git:/bin/bash
改为
git:x:1001:1001:,,,:/home/git:/usr/bin/git-shell
克隆远程仓库
$ git clone git@server:/srv/sample.git
Cloning into 'sample'...
warning: You appear to have cloned an empty repository.