GitWeb (Ubuntu): Unterschied zwischen den Versionen

Aus Tutorials
Zur Navigation springen Zur Suche springen
Zeile 1: Zeile 1:
== Installation ==


<pre>
git clone git://git.kernel.org/pub/scm/git/git.git
cd git
make GITWEB_PROJECTROOT="/home/git" prefix=/usr gitweb
sudo cp -Rf gitweb /var/www/
sudo chown -R www-data:www-data /var/www/gitweb
</pre>


Bzw. über
<pre>
sudo apt-get install gitweb
</pre>


== Konfiguration ==
=== Apache ===
<pre>
sudo -u www-data htdigest -c /home/git/.htpasswd "Shared Git Repo" martin
</pre>
<pre>
cd /etc/apache2/sites-available/
</pre>
==== http ====
<pre>
sudo vi gitweb.conf
</pre>
<pre>
<virtualhost *:80>
    ServerName git.<domain>
    DocumentRoot /var/www/gitweb
    <Directory /var/www/gitweb>
        Options +FollowSymLinks +ExecCGI
        AddHandler cgi-script .cgi
        DirectoryIndex gitweb.cgi
    </Directory>
    ScriptAliasMatch \
        "(?x)^/(.*/(HEAD | \
        info/refs | \
        objects/(info/[^/]+ | \
        [0-9a-f]{2}/[0-9a-f]{38} | \
        pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
        git-(upload|receive)-pack))$" \
        /usr/lib/git-core/git-http-backend/$1
    SetEnv GIT_PROJECT_ROOT /home/git
    SetEnv GIT_HTTP_EXPORT_ALL
    SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER
    <Location />
        AuthType Digest
        AuthName "Shared Git Repo"
        AuthUserFile /home/git/.htpasswd
        Require valid-user
    </Location>
    ErrorLog ${APACHE_LOG_DIR}/gitweb.<domain>-error.log
    CustomLog ${APACHE_LOG_DIR}/gitweb.<domain>-access.log combined
</virtualhost>
</pre>
<pre>
sudo a2ensite gitweb.conf
sudo service apache2 reload
</pre>
==== https ====
SSL-Zertifikat erstellen - dazu siehe [[SSL_Zertifikat]]
<pre>
sudo vi gitweb.conf
</pre>
<pre>
<VirtualHost *:80>
        ServerName git.<domain>
        ServerAlias git.<domain>
        Redirect / https://git.<domain>
</VirtualHost>
</pre>
<pre>
sudo vi gitweb-ssl.conf
</pre>
<pre>
<virtualhost *:443>
    ServerName git.kirner.or.at
    DocumentRoot /var/www/gitweb
    SSLEngine On
    SSLCertificateFile /etc/ssl/certs/git.crt
    SSLCertificateKeyFile /etc/ssl/private/apache.key
    <Directory /var/www/gitweb>
        Options +FollowSymLinks +ExecCGI
        AddHandler cgi-script .cgi
        DirectoryIndex gitweb.cgi
    </Directory>
    ScriptAliasMatch \
        "(?x)^/(.*/(HEAD | \
        info/refs | \
        objects/(info/[^/]+ | \
        [0-9a-f]{2}/[0-9a-f]{38} | \
        pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
        git-(upload|receive)-pack))$" \
        /usr/lib/git-core/git-http-backend/$1
    SetEnv GIT_PROJECT_ROOT /home/git
    SetEnv GIT_HTTP_EXPORT_ALL
    SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER
    <Location />
        AuthType Digest
        AuthName "Shared Git Repo"
        AuthUserFile /home/git/.htpasswd
        Require valid-user
    </Location>
    ErrorLog ${APACHE_LOG_DIR}/gitweb.<domain>-error.log
    CustomLog ${APACHE_LOG_DIR}/gitweb.<domain>-access.log combined
</VirtualHost>
</pre>
<pre>
sudo a2ensite gitweb-ssl.conf
sudo service apache2 reload
</pre>
=== Beschreibung ändern ===
Die Beschreibung
<pre>
Unnamed repository; edit this file 'description' to name the repository.
</pre>
ändert man durch editieren der Datei
<pre>
<root directory>/<repo>.git/description
</pre>
Bei einem Klon des Repositories wird diese Beschreibung jedoch nicht übernommen.
== Links ==
[https://git-scm.com/book/de/v1/Git-auf-dem-Server-GitWeb https://git-scm.com/book/de/v1/Git-auf-dem-Server-GitWeb]




Zurück zu [[Git Server (Linux)#Webinterface|Git Server]]
Zurück zu [[Git Server (Linux)#Webinterface|Git Server]]

Version vom 24. Februar 2018, 17:46 Uhr

Installation

git clone git://git.kernel.org/pub/scm/git/git.git
cd git
make GITWEB_PROJECTROOT="/home/git" prefix=/usr gitweb
sudo cp -Rf gitweb /var/www/
sudo chown -R www-data:www-data /var/www/gitweb

Bzw. über

sudo apt-get install gitweb

Konfiguration

Apache

sudo -u www-data htdigest -c /home/git/.htpasswd "Shared Git Repo" martin
cd /etc/apache2/sites-available/

http

sudo vi gitweb.conf
<virtualhost *:80>
    ServerName git.<domain>
    DocumentRoot /var/www/gitweb

    <Directory /var/www/gitweb>
        Options +FollowSymLinks +ExecCGI
        AddHandler cgi-script .cgi
        DirectoryIndex gitweb.cgi
    </Directory>

    ScriptAliasMatch \
        "(?x)^/(.*/(HEAD | \
        info/refs | \
        objects/(info/[^/]+ | \
        [0-9a-f]{2}/[0-9a-f]{38} | \
        pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
        git-(upload|receive)-pack))$" \
        /usr/lib/git-core/git-http-backend/$1

    SetEnv GIT_PROJECT_ROOT /home/git
    SetEnv GIT_HTTP_EXPORT_ALL
    SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER

    <Location />
        AuthType Digest
        AuthName "Shared Git Repo"
        AuthUserFile /home/git/.htpasswd
        Require valid-user
    </Location>

    ErrorLog ${APACHE_LOG_DIR}/gitweb.<domain>-error.log
    CustomLog ${APACHE_LOG_DIR}/gitweb.<domain>-access.log combined
</virtualhost>
sudo a2ensite gitweb.conf
sudo service apache2 reload

https

SSL-Zertifikat erstellen - dazu siehe SSL_Zertifikat

sudo vi gitweb.conf
<VirtualHost *:80>
        ServerName git.<domain>
        ServerAlias git.<domain>
        Redirect / https://git.<domain>
</VirtualHost>
sudo vi gitweb-ssl.conf 
<virtualhost *:443>
    ServerName git.kirner.or.at
    DocumentRoot /var/www/gitweb


    SSLEngine On
    SSLCertificateFile /etc/ssl/certs/git.crt
    SSLCertificateKeyFile /etc/ssl/private/apache.key

    <Directory /var/www/gitweb>
        Options +FollowSymLinks +ExecCGI
        AddHandler cgi-script .cgi
        DirectoryIndex gitweb.cgi
    </Directory>

    ScriptAliasMatch \
        "(?x)^/(.*/(HEAD | \
        info/refs | \
        objects/(info/[^/]+ | \
        [0-9a-f]{2}/[0-9a-f]{38} | \
        pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
        git-(upload|receive)-pack))$" \
        /usr/lib/git-core/git-http-backend/$1

    SetEnv GIT_PROJECT_ROOT /home/git
    SetEnv GIT_HTTP_EXPORT_ALL
    SetEnv REMOTE_USER=$REDIRECT_REMOTE_USER

    <Location />
        AuthType Digest
        AuthName "Shared Git Repo"
        AuthUserFile /home/git/.htpasswd
        Require valid-user
    </Location>

    ErrorLog ${APACHE_LOG_DIR}/gitweb.<domain>-error.log
    CustomLog ${APACHE_LOG_DIR}/gitweb.<domain>-access.log combined
</VirtualHost>
sudo a2ensite gitweb-ssl.conf
sudo service apache2 reload

Beschreibung ändern

Die Beschreibung

Unnamed repository; edit this file 'description' to name the repository.

ändert man durch editieren der Datei

<root directory>/<repo>.git/description

Bei einem Klon des Repositories wird diese Beschreibung jedoch nicht übernommen.

Links

https://git-scm.com/book/de/v1/Git-auf-dem-Server-GitWeb


Zurück zu Git Server