Git-aware CGI to provide dumb HTTP transport
[git] / Documentation / git-http-backend.txt
1 git-http-backend(1)
2 ===================
3
4 NAME
5 ----
6 git-http-backend - Server side implementation of Git over HTTP
7
8 SYNOPSIS
9 --------
10 [verse]
11 'git-http-backend'
12
13 DESCRIPTION
14 -----------
15 A simple CGI program to serve the contents of a Git repository to Git
16 clients accessing the repository over http:// and https:// protocols.
17
18 By default, only the `upload-pack` service is enabled, which serves
19 'git-fetch-pack' and 'git-ls-remote' clients, which are invoked from
20 'git-fetch', 'git-pull', and 'git-clone'.
21
22 This is ideally suited for read-only updates, i.e., pulling from
23 git repositories.
24
25 URL TRANSLATION
26 ---------------
27 'git-http-backend' relies on the invoking web server to perform
28 URL to path translation, and store the repository path into the
29 PATH_TRANSLATED environment variable.  Most web servers will do
30 this translation automatically, resolving the suffix after the
31 CGI name relative to the server's document root.
32
33 EXAMPLES
34 --------
35
36 Apache 2.x::
37         To serve all Git repositories contained within the '/git/'
38         subdirectory of the DocumentRoot, ensure mod_cgi and
39         mod_alias are enabled, and create a ScriptAlias to the CGI:
40 +
41 ----------------------------------------------------------------
42 ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/git/
43
44 <Directory /usr/libexec/git-core>
45         Options None
46 </Directory>
47 <Files /usr/libexec/git-core/git-http-backend>
48         Options ExecCGI
49 </Files>
50 ----------------------------------------------------------------
51 +
52 To require authentication for reads, use a Directory
53 directive around the repository, or one of its parent directories:
54 +
55 ----------------------------------------------------------------
56 <Directory /var/www/git/private>
57         AuthType Basic
58         AuthName "Private Git Access"
59         Require group committers
60         ...
61 </Directory>
62 ----------------------------------------------------------------
63
64 Accelerated static Apache 2.x::
65         Similar to the above, but Apache can be used to return static
66         files that are stored on disk.  On many systems this may
67         be more efficient as Apache can ask the kernel to copy the
68         file contents from the file system directly to the network:
69 +
70 ----------------------------------------------------------------
71 DocumentRoot /var/www
72
73 ScriptAlias /git/        /usr/libexec/git-core/git-http-backend/git/
74 Alias       /git_static/ /var/www/git/
75
76 RewriteEngine on
77 RewriteRule ^/git/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$    /git_static/$1 [PT]
78 RewriteRule ^/git/(.*/objects/pack/pack-[0-9a-f]{40}.pack)$ /git_static/$1 [PT]
79 RewriteRule ^/git/(.*/objects/pack/pack-[0-9a-f]{40}.idx)$  /git_static/$1 [PT]
80 ----------------------------------------------------------------
81
82
83 ENVIRONMENT
84 -----------
85 'git-http-backend' relies upon the CGI environment variables set
86 by the invoking web server, including:
87
88 * PATH_TRANSLATED
89 * REMOTE_USER
90 * REMOTE_ADDR
91 * CONTENT_TYPE
92 * QUERY_STRING
93 * REQUEST_METHOD
94
95 Author
96 ------
97 Written by Shawn O. Pearce <spearce@spearce.org>.
98
99 Documentation
100 --------------
101 Documentation by Shawn O. Pearce <spearce@spearce.org>.
102
103 GIT
104 ---
105 Part of the linkgit:git[1] suite