LoginSignup
2
1

More than 5 years have passed since last update.

GitListの設定

Posted at

前の記事でgitリポジトリの管理としてGiteaを試してみました。残念ながら既存のリポジトリを移行する簡単な方法がないということで採用を諦めました。なので、次の候補を探していたところGitListというツールを見つけました。
 Giteaと異なり、リポジトリの作成などはできず、単にリポジトリを閲覧することしかできません。その代わり、既存のリポジトリであっても、特に何もせずに一覧表示、コミットログの表示、ファイルの閲覧をすることが可能です。
以下で、Ubuntu Server 16.04に、Apache2 + PHP 7でインストールする手順を説明します。

インストール手順

必要なパッケージのインストール

GitListはPHPのSilexフレームワーク上で動作しますが、こちらはGitListに同梱されています。データベースは不要です。なので、Apache2 + PHP7のみをインストールします。
$ sudo apt install apache2 php7.0 php7.0-gd php7.0-mbstring php7.0-xml libapache2-mod-php7.0

gitlistのダウンロードと展開

最新版のバージョン0.6をダウンロードし、/var/www/htmlに展開します。
$ wget https://github.com/klaussilveira/gitlist/releases/download/0.6.0/gitlist-0.6.0.tar.gz
$ sudo tar -C /var/www/html -xzf gitlist-0.6.0.tar.gz

mod_rewriteとphpの有効化

Silexフレームワークはmod_rewriteを必要としますので、mod_rewriteを有効化します。
$ sudo a2enmod rewrite
$ sudo a2enmod php7.0
$ sudo service apache2 restart

.htaccessによる設定の上書きを許可

000-default.confに"AllowOverride All"を追加します。
$ sudo vim /etc/apache2/sites-available/000-default.conf

000-default.conf
<VirtualHost *:80>
  …
  DocumentRoot /var/www/html
  <Directory /var/www/html>
    AllowOverride All
  </Directory>
  …
</VirtualHost>

.htacesssの変更

GitListをサブディレクトリgitlistに入れているので、.htaccessのRewriteBaseに/gitlistを指定します。
$ sudo vim /var/www/html/gitlist/.htaccess

.htaccess
<IfModule mod_rewrite.c>
  …
  RewriteBase /gitlist

キャッシュディレクトリを作成

$ cd /var/www/html/gitlist
$ sudo mkdir cache
$ sudo chmod 777 cache

config.iniを設定

以下で、GitListのconfig.iniを設定します。ここでは以下のような設定にしていますので、ご自身の環境に合わせて随時変更してください。
サーバ名: gitserver
リポジトリパス: /home/git/gitrepos

$ cd /var/www/html/gitlist
$ sudo mv config.ini-example config.ini
$ sudo vim config.ini

config.ini
[git]
client = '/usr/bin/git' ; Your git executable path
default_branch = 'master' ; Default branch when HEAD is detached
repositories[] = '/home/git/gitrepos/' ; Path to your repositories
[app]
theme=”default”
[clone_button]
; ssh remote
show_ssh_remote = true
ssh_host = 'gitserver'
ssh_url_subdir = 'gitrepos/'
ssh_user = 'git'
ssh_user_dynamic = false

動作確認

以下のURLにアクセスすれば、リポジトリの一覧が表示されるはずです。
http://gitserver/gitlist
リポジトリ名とその説明が表示されますが、説明はリポジトリ以下のdescriptionファイルに書かれている内容が表示されます。例えば、test.gitというリポジトリであればtest.git/descriptionに説明を記述します。
ファイル構造がわかりにくいかもしれませんが、以下のような構造になります。

/home
  git
    gitrepos
      test1.git
        description
      test2.git
        description
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1