Ubuntu or Debian / GNU Linux native Git server
I met a lot of tutorials on the network on installing my git server on both gitweb and webdav, but, alas, they either were only on one of the above points, without covering the other, or they didn’t work corny. Yesterday, there was a need to raise your repository server. Spent a couple of hours - picked it up, now I want to share my experience, because I think the problem is relevant :)
The git.shadowircd.net repository was created for this guide .
To start, we will install some of the aptitude packages:
Create a folder to store the site with gitweb and the dav version of the git repository:
We activate the necessary Apache2 mods:
We compose the gitweb configuration file:
It looks like this for me:
Now let's move on to our vhost in apache2, and this is where the most interesting part is contained:
It remains only to add a new user:
All We create repositories in /www/git.domain.tld/htdocs/git/ and enjoy the most pleasant version control system of all :)
PS for Windows users, when using git, tip on disabling the auto-insert CRLF line break habrahabr.ru/blogs/ will be useful development / 43808
P.PS for Linux users - this server works using DAV, there may be problems with push, it is allowed to create a ~ / .netrc file with the following contents machine git.domain.tld login <user> password <password>
The git.shadowircd.net repository was created for this guide .
To start, we will install some of the aptitude packages:
aptitude install git-core git-svn gitweb
Create a folder to store the site with gitweb and the dav version of the git repository:
mkdir -p /www/git.domain.tld/{htdocs,logs} /www/git.domain.tld/htdocs/git
We activate the necessary Apache2 mods:
a2enmod dav
a2enmod dav_fs
a2enmod rewrite
a2enmod env
We compose the gitweb configuration file:
mcedit /www/git.domain.tld/gitweb.conf
It looks like this for me:
$ my_uri = “http: //git.domain.tld”; # repository address
$ site_name = “git.domain.tld”; # site name, displayed in the header
$ projectroot = “/www/git.domain.tld/htdocs/git/”; # path to git repositories on the hard drive
$ git_temp = “/ tmp”;
$ home_link = $ my_uri; # link to the "home page"
# $ home_text = “indextext.html”; # text, you can uncomment and paste your
$ projects_list = $ projectroot;
$ stylesheet = “/gitweb/gitweb.css”;
$ logo = “/gitweb/git-logo.png”;
$ favicon = “/gitweb/git-favicon.png”;
$ projects_list_description_width = 40;
$ feature {'pathinfo'} {'default'} = [1];
Now let's move on to our vhost in apache2, and this is where the most interesting part is contained:
ServerName git.domain.tld ServerAlias
www.git.domain.tld ServerAdmin
head@coderscamp.ru
DocumentRoot /www/git.domain.tld/htdocs
ScriptAlias / cgi-bin / / usr / lib / cgi-bin /
DirectoryIndex / cgi- bin / gitweb.cgi
RewriteEngine on
RewriteRule ^ / ([a-zA-Z0-9 _ \ -] + \ / \. git) /? (\?. *)? $ /cgi-bin/gitweb.cgi/$1 [ L, PT]
SetEnv GITWEB_CONFIG /www/git.domain.tld/gitweb.conf
Alias / gitweb / usr / share / gitweb /
Options FollowSymLinks
AllowOverride None
Order allow, deny
allow from all
DAV on
AuthType Basic
AuthName "Git"
AuthUserFile /www/git.domain.tld/passwd.git
Require valid-user
LogLevel warn
ErrorLog /www/git.domain.tld/logs/error.log
CustomLog /www/git.domain.tld/logs/access.log combined
It remains only to add a new user:
htpasswd -cm /www/git.domain.tld/passwd.git user
All We create repositories in /www/git.domain.tld/htdocs/git/ and enjoy the most pleasant version control system of all :)
PS for Windows users, when using git, tip on disabling the auto-insert CRLF line break habrahabr.ru/blogs/ will be useful development / 43808
P.PS for Linux users - this server works using DAV, there may be problems with push, it is allowed to create a ~ / .netrc file with the following contents machine git.domain.tld login <user> password <password>