macportsでgitをインストールしてgitweb.cgiで閲覧可能にする
下記の流れでgitのインストールとgitwebで閲覧まで可能。
% sudo port install git-core +gitweb +svn →macportsでgit-coreをgitwebとsvn連携を可能にしてインストール % mkdir $HOME/Sites/git →gitweb用のフォルダを作成 % cp /opt/local/share/git-core/gitweb/* $HOME/Sites/git/ % chmod 755 $HOME/Sites/git/gitweb.cgi % vi $HOME/Sites/git/gitweb.cgi →gitwebのCGIが利用するファイルを開きcgiの設定を行う % sudo vi /opt/local/apache2/conf/httpd.conf →以前にインストールしたApacheに設定を行う。 ユーザディレクトリの公開を有効にする。 % sudo vi /opt/local/apache2/conf/conf.d/user.conf →gitwebのCGIが動作するように設定を行う。 % mkdir $HOME/git →gitのリポジトリを設置するフォルダを作成する % mkdir $HOME/git/firstPj % cd $HOME/git/firstPj % git init % git add % vi first.txt % git add first.txt % git commit →初めてのgitリポジトリ用フォルダを作成し、 first.txtをコミットする。
httpd.conf
# User home directories #Include conf/extra/httpd-userdir.conf ↓ # User home directories Include conf/extra/httpd-userdir.conf
gitweb.cgi
our $projectroot = "/pub/git";
↓
our $projectroot = "/Users/bose999/git";
# URI of stylesheets
our @stylesheets = ("static/gitweb.css");
# URI of a single stylesheet, which can be overridden in GITWEB_CONFIG.
our $stylesheet = undef;
# URI of GIT logo (72x27 size)
our $logo = "static/git-logo.png";
# URI of GIT favicon, assumed to be image/png type
our $favicon = "static/git-favicon.png";
# URI of gitweb.js (JavaScript code for gitweb)
our $javascript = "static/gitweb.js";
↓
# URI of stylesheets
our @stylesheets = ("gitweb.css");
# URI of a single stylesheet, which can be overridden in GITWEB_CONFIG.
our $stylesheet = undef;
# URI of GIT logo (72x27 size)
our $logo = "git-logo.png";
# URI of GIT favicon, assumed to be image/png type
our $favicon = "git-favicon.png";
# URI of gitweb.js (JavaScript code for gitweb)
our $javascript = "gitweb.js";conf.d/user.conf
<Directory "/Users/{ユーザ名}/Sites/git/">
AddHandler cgi-script .cgi
Options ExecCGI
</Directory>※インターネットにCGIを公開するまでのセキュリティの考慮はしてません。