co.de.mon.key

Weblog

Git na apache2 przez davfs

| Comments

Szybkie repozytorium GIT przez HTTP w Debianie

Tworzymy podkatalog w katalogu VHosta

1
2
cd /var/www/domain.com
mkdir myrepo.git

Inicjacja repozytorium

1
2
cd myrepo.git
git --bare init

Ustawienie praw dostępu

1
chown -R www-data:www-data .

Dostosowanie gita pod http

1
git update-server-info

Włączenie davfs

1
a2enmod dav_fs

Dodanie konfiguracji davfs w /etc/apache2/sites-enabled/domain.com, najprostsza wersja bez autoryzacji:

1
2
3
4
<Location /myrepo.git>
    DAV on
    AuthType None
</Location>

lub trochę bardziej bezpieczna:

1
htpasswd /etc/apache2/passwords/passwd_git username
1
2
3
4
5
6
7
<Location /myrepo.git>
      DAV on
      AuthType Basic
      AuthName "Git"
      AuthUserFile /etc/apache2/passwords/passwd_git
      Require valid-user
</Location>

Restart apache

1
apache2 -k restart

Pierwszy test przez przeglądarkę: http://domain.com/myrepo.git

Comments