http-backend: reword some documentation
[git/jnareb-git.git] / Documentation / git-http-backend.txt
blob0b5e9515a1c7f246ee91c17cccc63a7f7080a80d
1 git-http-backend(1)
2 ===================
4 NAME
5 ----
6 git-http-backend - Server side implementation of Git over HTTP
8 SYNOPSIS
9 --------
10 [verse]
11 'git-http-backend'
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 The program supports clients fetching using both the smart HTTP protcol
18 and the backwards-compatible dumb HTTP protocol, as well as clients
19 pushing using the smart HTTP protocol.
21 By default, only the `upload-pack` service is enabled, which serves
22 'git-fetch-pack' and 'git-ls-remote' clients, which are invoked from
23 'git-fetch', 'git-pull', and 'git-clone'.  If the client is authenticated,
24 the `receive-pack` service is enabled, which serves 'git-send-pack'
25 clients, which is invoked from 'git-push'.
27 SERVICES
28 --------
29 These services can be enabled/disabled using the per-repository
30 configuration file:
32 http.uploadpack::
33         This serves 'git-fetch-pack' and 'git-ls-remote' clients.
34         It is enabled by default, but a repository can disable it
35         by setting this configuration item to `false`.
37 http.receivepack::
38         This serves 'git-send-pack' clients, allowing push.  It is
39         disabled by default for anonymous users, and enabled by
40         default for users authenticated by the web server.  It can be
41         disabled by setting this item to `false`, or enabled for all
42         users, including anonymous users, by setting it to `true`.
44 URL TRANSLATION
45 ---------------
46 To determine the location of the repository on disk, 'git-http-backend'
47 concatenates the environment variables PATH_INFO, which is set
48 automatically by the web server, and GIT_PROJECT_ROOT, which must be set
49 manually in the web server configuration.  If GIT_PROJECT_ROOT is not
50 set, 'git-http-backend' reads PATH_TRANSLATED, which is also set
51 automatically by the web server.
53 EXAMPLES
54 --------
55 All of the following examples map 'http://$hostname/git/foo/bar.git'
56 to '/var/www/git/foo/bar.git'.
58 Apache 2.x::
59         Ensure mod_cgi, mod_alias, and mod_env are enabled, set
60         GIT_PROJECT_ROOT (or DocumentRoot) appropriately, and
61         create a ScriptAlias to the CGI:
63 ----------------------------------------------------------------
64 SetEnv GIT_PROJECT_ROOT /var/www/git
65 ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/
66 ----------------------------------------------------------------
68 To enable anonymous read access but authenticated write access,
69 require authorization with a LocationMatch directive:
71 ----------------------------------------------------------------
72 <LocationMatch ".*/git-receive-pack$">
73         AuthType Basic
74         AuthName "Git Access"
75         Require group committers
76         ...
77 </LocationMatch>
78 ----------------------------------------------------------------
80 To require authentication for both reads and writes, use a Location
81 directive around the repository, or one of its parent directories:
83 ----------------------------------------------------------------
84 <Location /git/private>
85         AuthType Basic
86         AuthName "Private Git Access"
87         Require group committers
88         ...
89 </Location>
90 ----------------------------------------------------------------
92 Accelerated static Apache 2.x::
93         Similar to the above, but Apache can be used to return static
94         files that are stored on disk.  On many systems this may
95         be more efficient as Apache can ask the kernel to copy the
96         file contents from the file system directly to the network:
98 ----------------------------------------------------------------
99 SetEnv GIT_PROJECT_ROOT /var/www/git
101 ScriptAlias /git/        /usr/libexec/git-core/git-http-backend/
102 Alias       /git_static/ /var/www/git/
104 RewriteEngine on
105 RewriteRule ^/git/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$    /git_static/$1 [PT]
106 RewriteRule ^/git/(.*/objects/pack/pack-[0-9a-f]{40}.pack)$ /git_static/$1 [PT]
107 RewriteRule ^/git/(.*/objects/pack/pack-[0-9a-f]{40}.idx)$  /git_static/$1 [PT]
108 ----------------------------------------------------------------
111 ENVIRONMENT
112 -----------
113 'git-http-backend' relies upon the CGI environment variables set
114 by the invoking web server, including:
116 * PATH_INFO (if GIT_PROJECT_ROOT is set, otherwise PATH_TRANSLATED)
117 * REMOTE_USER
118 * REMOTE_ADDR
119 * CONTENT_TYPE
120 * QUERY_STRING
121 * REQUEST_METHOD
123 The backend process sets GIT_COMMITTER_NAME to '$REMOTE_USER' and
124 GIT_COMMITTER_EMAIL to '$\{REMOTE_USER}@http.$\{REMOTE_ADDR\}',
125 ensuring that any reflogs created by 'git-receive-pack' contain some
126 identifying information of the remote user who performed the push.
128 All CGI environment variables are available to each of the hooks
129 invoked by the 'git-receive-pack'.
131 Author
132 ------
133 Written by Shawn O. Pearce <spearce@spearce.org>.
135 Documentation
136 --------------
137 Documentation by Shawn O. Pearce <spearce@spearce.org>.
141 Part of the linkgit:git[1] suite