安装平台: ubuntu 10.04
搭建git服务器,需要如下软件:
$ sudo apt-get install openssh-server openssh-client
$ sudo apt-get install git
$ sudo apt-get install python-setuptools
源码删除gitosis
使用git下载源码:
$ git clone https://github.com/meegoo-tsui/gitosis.git gitosis.git
$ cd gitosis.git
$ sudo python setup.py install --record uninstall.txt
$ cat uninstall.txt | xargs sudo rm -rf
源码安装gitolite
使用git下载源码:
$ git clone git://github.com/sitaramc/gitolite gitolite.git
$ cd gitolite.git
$ sudo mkdir /usr/local/gitolite
$ sudo ./install -to /usr/local/gitolite
账户相关信息
创建用户git
$ sudo adduser --system --shell /bin/bash --disabled-password --group git
$ sudo usermod -G git -a www-data
初始化全局设置 Liquid error: undefined method `Py_IsInitialized' for RubyPython::Python:Module
初始化gitolite
生成 SSH key:
$ sudo su - git
$ ssh-keygen -t rsa -C "meegoo.tsui@gmail.com"
$ /usr/local/gitolite/gitolite setup -pk ~/.ssh/id_rsa.pub
文件内容如下:
Liquid error: undefined method Py_IsInitialized' for RubyPython::Python:Module
修改文件
sudo gedit /home/git/.gitolite.rc`:
UMASK => 0022,
GIT_CONFIG_KEYS => '.*',
GITWEB_PROJECTS_LIST => '/home/git/projects.list',
clone gitolite管理平台:
$ git clone git@127.0.0.1:gitolite-admin.git gitolite-admin.git
创建版本项目:
$ mkdir test.git;cd test.git
$ git init
$ git commit --allow-empty -m "create the repos."
$ git remote add origin git@127.0.0.1:test.git
$ git push -u origin master
gitweb安装及配置
安装gitweb:
$ sudo apt-get install highlight gitweb
配置apache服务器:
$ sudo gedit /etc/apache2/conf.d/gitweb
添加内容如下:
Alias /gitweb /usr/share/gitweb
<Directory /usr/share/gitweb>
Options FollowSymLinks +ExecCGI
AddHandler cgi-script .cgi
DirectoryIndex index.cgi gitweb.cgi
AuthType Basic
AuthName "Authentication Required"
AuthUserFile "/home/apache2/apache2.passwd"
Require valid-user
order Allow,Deny
Allow from all
</Directory>
修改gitweb配置文件:
$ sudo vim /etc/gitweb.conf
$ sudo /etc/init.d/apache2 restart
# 修改内容如下:
$projectroot = "/home/git/repositories";
$home_text = "/home/git/indextext.html";
$projects_list = "/home/git/projects.list";
# Add Highlighting at the end
$feature{'highlight'}{'default'} = [1];
访问: http://127.0.0.1/gitweb