# 1) python이 설치되어 있지 않다면 설치해야 합니다.
# 반드시 2.5.2 버젼을 설치할 필요는 없습니다.
# 가장 최신 버젼을 설치하면 됩니다.
tar zxf Python-2.5.2.tgz
cd Python-2.5.2
./configure --prefix=$HOME
make
make install
cd ..
export PATH=$HOME/bin:$PATH
# 2) setuptools를 설치합니다. (gitosis를 설치하기 위해 필요합니다)
3. Install git
# 1) git를 설치합니다.
# 반드시 1.6.5.5를 설치하실 필요는 없습니다.
# 가장 최신 버젼을 설치하면 됩니다.
tar zxf git-1.6.5.5.tar.gz
cd git-1.6.5.5
make
configure
./configure
make
make install
cd ..
# 2) gitweb을 설치합니다.
# gitweb package source는 git에 포함되어 있습니다.
# make할 때 bindir은 git가 설치되어 있는 위치여야 합니다.
cd git-1.6.5.5
make GITWEB_PROJECTROOT="/home/git/repositories" \
GITWEB_CSS="/gitweb/gitweb.css" \
GITWEB_LOGO="/gitweb/git-logo.png" \
GITWEB_FAVICON="/gitweb/git-favicon.png" \
bindir=/usr/local/bin \
gitweb/gitweb.cgi
mkdir /var/www/cgi-bin/gitweb
cp -fv gitweb/gitweb.{cgi,css} \
gitweb/git-{favicon,logo}.png \
/var/www/cgi-bin/gitweb/
cd ..
4. Install gitosis
# 1) gitosis를 설치합니다.
git clone git://eagain.net/gitosis.git
cd gitosis
python setup.py install
# 2) git user를 만듭니다.
useradd \
-s /bin/sh \
-c 'git version control' \
-r \
-d /home/git \
git
mkdir -p /home/git
chown git:apache /home/git
# 그룹을 apache로 한 이유는 apache가
# repositories를 접근할 수 있어야 하기 때문입니다.
# gitweb를 사용하지 않는다면 굳이 apache로 할 필요는 없습니다.
# 3) git repositories를 만듭니다.
sudo chmod 755 /home/git/repositories/gitosis-admin.git/post-update
nohup sudo -u git git daemon --base-path /home/git/repositories &
4) gitweb을 설정합니다.
아래와 같이 /home/git/gitosis/gitweb.conf를 만듭니다.
# Include the global configuration, if found.
do "/etc/gitweb.conf" if -e "/etc/gitweb.conf";
$GIT = "/usr/local/bin/git";
$stylesheet = "/gitweb.css";
$logo = "/git-logo.png";
$favicon = "/git-favicon.png";
# Point to projects.list file generated by gitosis.
# Here gitosis manages the user "git", who has a
# home directory of /home/git
$projects_list = "/home/git/repositories";
# Where the actual repositories are located.
$projectroot = "/home/git/repositories";
# By default, gitweb will happily let people browse any repository
# they guess the name of. This may or may not be what you want.
# I prefer to set these, to allow exactly the repositories in
# projects.list to be browsed.
$export_ok = "git-daemon-export-ok";
$strict_export = "true";
# A list of base urls where all the repositories can be cloned from.
# Easier than having per-repository cloneurl files.
$home_text = "$projectroot/indextext.html";
# Just for a little more security
$prevent_xss = true;
# turn off potentially CPU-intensive features
$feature{'search'}{'default'} = [1];
$feature{'blame'}{'default'} = [1];
$feature{'blame'}{'override'} = 1;
$feature{'pickaxe'}{'default'} = [1];
$feature{'pickaxe'}{'override'} = 1;
$feature{'snapshot'}{'default'} = ['zip', 'tgz'];
$feature{'snapshot'}{'override'} = 1;
$feature{'grep'}{'default'} = [1];
$feature{'grep'}{'override'} = 1;
# nicer-looking URLs
$feature{'pathinfo'}{'default'} = [1];
$site_name = "server's git repositories";
5) 아래와 같이 /etc/httpd/conf.d/gitweb-vhosts.conf를 만듭니다.
<virtualhost *:80="">
ServerName git.server.domain.here
SetEnv GITWEB_CONFIG /home/git/gitosis/gitweb.conf
Alias /gitweb.css /var/www/cgi-bin/gitweb/gitweb.css
Alias /git-logo.png /var/www/cgi-bin/gitweb/git-logo.png
Alias /git-favicon.png /var/www/cgi-bin/gitweb/git-favicon.png
ScriptAlias /cgi-bin /var/www/cgi-bin
DocumentRoot /home/git/repositories
<directory home="" git="" repositories="">
Options Indexes FollowSymlinks ExecCGI
AllowOverride None
Order allow,deny
Allow from all
DirectoryIndex /cgi-bin/gitweb/gitweb.cgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.* /cgi-bin/gitweb/gitweb.cgi/$0 [L,PT]
</directory>
ErrorLog /var/log/httpd/gitweb.error.log
CustomLog /var/log/httpd/gitweb.access.log combined
</virtualhost>
# 6) apache를 재시작합니다.
service httpd restart
5. Configure gitosis
# 1) git user information을 설정합니다.
git config --global user.name "Your Name"
# 2) git admin 용으로 만든 SSH key를 자신의 machine으로 가져오고
# git server에서 gitosis-admin을 가져옵니다.
cd gitosis-admin
3) gitosis.conf를 다음과 같이 수정합니다.
[gitosis]
## To override the default ~/repositories path
# repositories = repositories
## Allow gitweb to show all known repositories. If you want gitweb,
## you need either this or a [repo foo] section for each repository
## you want visible in gitweb.
gitweb = no
## Allow git-daemon to publish all known repositories. As with gitweb,
## this can be done globally or per-repository.
daemon = no
## Logging level, one of DEBUG, INFO, WARNING, ERROR, CRITICAL
loglevel = WARNING
[group gitosis-admin]
writable = gitosis-admin project-1 project-2 project-3
readonly = proejct-2 project-3
[group user-2]
readonly = project-1 project-3
## You can play fancy tricks by making some repositories appear with
## different names in different contexts. Not really supported
## everywhere (e.g. gitweb) and can be confusing -- experts only.
# map writable visiblename1 = actualname1
# map readonly visiblename2 = actualname2
[repo proejct-1]
## Allow gitweb to show this repository.
gitweb = yes
## Oneline description of the project, mostly for gitweb.
description = Some project descriptions
## Owner of this repository. Used in gitweb list of projects.
owner = Some user descriptions
## Allow git-daemon to publish this repository.
daemon = yes
[repo project-2]
gitweb = yes
description = Some project descriptions
owner = Some user descriptions
daemon = yes
[repo project-3]
gitweb = yes
description = Some project descriptions
owner = Some user descriptions
daemon = yes
[gitweb]
## Where to make gitweb link to as it's "home location".
## NOT YET IMPLEMENTED.
# 4) user들의 SSH key를 추가하고 commit 합니다.
git commit -a -m "initial configuration"
git push
# 5) 각각의 project를 만들고 commit 합니다.
mkdir "project"
cd "project"
git init
touch README
git add README
git commit -m "initial repo"
git push origin master:refs/heads/master