Git server安装笔记

December 18th, 2010 1 comment

因为Mercurial缺乏对100MB+的binary文件支持,所以今天又把Git装上测试一下,环境是在一台Ubuntu 10.04 amd64 server edition机器上,通过http访问Git。

首先升级系统到最新:

#apt-get update && apt-get upgrade

安装Git

#apt-get install git git-core gitosis
#mkdir /var/www/code.git && cd /var/www/code.git
#git --bare init && git update-server-info
#chown -R www-data:www-data .

配置Apache2

#apt-get install apache2 apache2-mpm-prefork

在/etc/apache2/conf.d中加入git.conf

<Location /code.git>
DAV on
AuthType Basic
AuthName "Git"
AuthUserFile /etc/apache2/dav_svn.passwd
Require valid-user
</Location>

重启apache2
# service apache2 restart

Done.

参考文档 how to setup a git server – The Linux Kernel Archives