6 git-http-backend - Server side implementation of Git over HTTP
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.
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'.
22 This is ideally suited for read-only updates, i.e., pulling from
27 These services can be enabled/disabled using the per-repository
31 This serves 'git-fetch-pack' and 'git-ls-remote' clients.
32 It is enabled by default, but a repository can disable it
33 by setting this configuration item to `false`.
36 This serves 'git-send-pack' clients, allowing push. It is
37 disabled by default for anonymous users, and enabled by
38 default for users authenticated by the web server. It can be
39 disabled by setting this item to `false`, or enabled for all
40 users, including anonymous users, by setting it to `true`.
44 'git-http-backend' relies on the invoking web server to perform
45 URL to path translation, and store the repository path into the
46 PATH_TRANSLATED environment variable. Most web servers will do
47 this translation automatically, resolving the suffix after the
48 CGI name relative to the server's document root.
54 To serve all Git repositories contained within the '/git/'
55 subdirectory of the DocumentRoot, ensure mod_cgi and
56 mod_alias are enabled, and create a ScriptAlias to the CGI:
58 ----------------------------------------------------------------
59 ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/git/
61 <Directory /usr/libexec/git-core>
64 <Files /usr/libexec/git-core/git-http-backend>
67 ----------------------------------------------------------------
69 To enable anonymous read access but authenticated write access,
70 require authorization with a LocationMatch directive:
72 ----------------------------------------------------------------
73 <LocationMatch ".*/git-receive-pack$">
76 Require group committers
79 ----------------------------------------------------------------
81 To require authentication for both reads and writes, use a Directory
82 directive around the repository, or one of its parent directories:
84 ----------------------------------------------------------------
85 <Directory /var/www/git/private>
87 AuthName "Private Git Access"
88 Require group committers
91 ----------------------------------------------------------------
93 Accelerated static Apache 2.x::
94 Similar to the above, but Apache can be used to return static
95 files that are stored on disk. On many systems this may
96 be more efficient as Apache can ask the kernel to copy the
97 file contents from the file system directly to the network:
99 ----------------------------------------------------------------
100 DocumentRoot /var/www
102 ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/git/
103 Alias /git_static/ /var/www/git/
106 RewriteRule ^/git/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ /git_static/$1 [PT]
107 RewriteRule ^/git/(.*/objects/pack/pack-[0-9a-f]{40}.pack)$ /git_static/$1 [PT]
108 RewriteRule ^/git/(.*/objects/pack/pack-[0-9a-f]{40}.idx)$ /git_static/$1 [PT]
109 ----------------------------------------------------------------
114 'git-http-backend' relies upon the CGI environment variables set
115 by the invoking web server, including:
124 The backend process sets GIT_COMMITTER_NAME to '$REMOTE_USER' and
125 GIT_COMMITTER_EMAIL to '$\{REMOTE_USER}@http.$\{REMOTE_ADDR\}',
126 ensuring that any reflogs created by 'git-receive-pack' contain some
127 identifying information of the remote user who performed the push.
129 All CGI environment variables are available to each of the hooks
130 invoked by the 'git-receive-pack'.
134 Written by Shawn O. Pearce <spearce@spearce.org>.
138 Documentation by Shawn O. Pearce <spearce@spearce.org>.
142 Part of the linkgit:git[1] suite