1git-http-backend(1) 2=================== 3 4NAME 5---- 6git-http-backend - Server side implementation of Git over HTTP 7 8SYNOPSIS 9-------- 10[verse] 11'git-http-backend' 12 13DESCRIPTION 14----------- 15A simple CGI program to serve the contents of a Git repository to Git 16clients accessing the repository over http:// and https:// protocols. 17 18By 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 22This is ideally suited for read-only updates, i.e., pulling from 23git repositories. 24 25SERVICES 26-------- 27These services can be enabled/disabled using the per-repository 28configuration file: 29 30http.uploadpack:: 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`. 34 35http.receivepack:: 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`. 41 42URL TRANSLATION 43--------------- 44'git-http-backend' relies on the invoking web server to perform 45URL to path translation, and store the repository path into the 46PATH_TRANSLATED environment variable. Most web servers will do 47this translation automatically, resolving the suffix after the 48CGI name relative to the server's document root. 49 50EXAMPLES 51-------- 52 53Apache 2.x:: 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: 57+ 58---------------------------------------------------------------- 59ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/git/ 60 61<Directory /usr/libexec/git-core> 62 Options None 63</Directory> 64<Files /usr/libexec/git-core/git-http-backend> 65 Options ExecCGI 66</Files> 67---------------------------------------------------------------- 68+ 69To enable anonymous read access but authenticated write access, 70require authorization with a LocationMatch directive: 71+ 72---------------------------------------------------------------- 73<LocationMatch ".*/git-receive-pack$"> 74 AuthType Basic 75 AuthName "Git Access" 76 Require group committers 77 ... 78</LocationMatch> 79---------------------------------------------------------------- 80+ 81To require authentication for both reads and writes, use a Directory 82directive around the repository, or one of its parent directories: 83+ 84---------------------------------------------------------------- 85<Directory /var/www/git/private> 86 AuthType Basic 87 AuthName "Private Git Access" 88 Require group committers 89 ... 90</Directory> 91---------------------------------------------------------------- 92 93Accelerated 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: 98+ 99---------------------------------------------------------------- 100DocumentRoot /var/www 101 102ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/git/ 103Alias /git_static/ /var/www/git/ 104 105RewriteEngine on 106RewriteRule ^/git/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ /git_static/$1 [PT] 107RewriteRule ^/git/(.*/objects/pack/pack-[0-9a-f]{40}.pack)$ /git_static/$1 [PT] 108RewriteRule ^/git/(.*/objects/pack/pack-[0-9a-f]{40}.idx)$ /git_static/$1 [PT] 109---------------------------------------------------------------- 110 111 112ENVIRONMENT 113----------- 114'git-http-backend' relies upon the CGI environment variables set 115by the invoking web server, including: 116 117* PATH_TRANSLATED 118* REMOTE_USER 119* REMOTE_ADDR 120* CONTENT_TYPE 121* QUERY_STRING 122* REQUEST_METHOD 123 124The backend process sets GIT_COMMITTER_NAME to '$REMOTE_USER' and 125GIT_COMMITTER_EMAIL to '$\{REMOTE_USER}@http.$\{REMOTE_ADDR\}', 126ensuring that any reflogs created by 'git-receive-pack' contain some 127identifying information of the remote user who performed the push. 128 129All CGI environment variables are available to each of the hooks 130invoked by the 'git-receive-pack'. 131 132Author 133------ 134Written by Shawn O. Pearce <spearce@spearce.org>. 135 136Documentation 137-------------- 138Documentation by Shawn O. Pearce <spearce@spearce.org>. 139 140GIT 141--- 142Part of the linkgit:git[1] suite