Ubuntu 24.04 Gitweb をインストールする方法

環境
Ubuntu 24.04
Apache2

概要
Gitweb をインストールして、Web ブラウザー経由で Git リポジトリが参照できます。

1.Gitweb をインストールします。
# apt -y install gitweb

2.gitweb.confを編集します
# vi /etc/gitweb.conf

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# 2行目 : Git リポジトリのルートディレクトリ
$projectroot = "/var/lib/git";
root@dlp:~# vi /etc/apache2/conf-available/gitweb.conf
Alias /gitweb /usr/share/gitweb
<Directory /usr/share/gitweb>
Options +FollowSymLinks +ExecCGI
AddHandler cgi-script .cgi
# アクセス許可IPを追記
Require ip 127.0.0.1 10.0.0.0/24
</Directory>
# 2行目 : Git リポジトリのルートディレクトリ $projectroot = "/var/lib/git"; root@dlp:~# vi /etc/apache2/conf-available/gitweb.conf Alias /gitweb /usr/share/gitweb <Directory /usr/share/gitweb> Options +FollowSymLinks +ExecCGI AddHandler cgi-script .cgi # アクセス許可IPを追記 Require ip 127.0.0.1 10.0.0.0/24 </Directory>
# 2行目 : Git リポジトリのルートディレクトリ
$projectroot = "/var/lib/git";
root@dlp:~# vi /etc/apache2/conf-available/gitweb.conf
Alias /gitweb /usr/share/gitweb

  <Directory /usr/share/gitweb>
    Options +FollowSymLinks +ExecCGI
    AddHandler cgi-script .cgi
    # アクセス許可IPを追記
    Require ip 127.0.0.1 10.0.0.0/24
  </Directory>

3.apache2を再起動する
# a2enmod cgi rewrite
# systemctl restart apache2

4.クライアントコンピューターから [(サーバーのホスト名 または IP アドレス/gitweb/)] に
Web アクセスすると Git リポジトリが参照可能になります。

IT

Posted by arkgame