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 25URL TRANSLATION 26--------------- 27'git-http-backend' relies on the invoking web server to perform 28URL to path translation, and store the repository path into the 29PATH_TRANSLATED environment variable. Most web servers will do 30this translation automatically, resolving the suffix after the 31CGI name relative to the server's document root. 32 33EXAMPLES 34-------- 35 36Apache 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---------------------------------------------------------------- 42ScriptAlias /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+ 52To require authentication for reads, use a Directory 53directive 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 64Accelerated 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---------------------------------------------------------------- 71DocumentRoot /var/www 72 73ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/git/ 74Alias /git_static/ /var/www/git/ 75 76RewriteEngine on 77RewriteRule ^/git/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ /git_static/$1 [PT] 78RewriteRule ^/git/(.*/objects/pack/pack-[0-9a-f]{40}.pack)$ /git_static/$1 [PT] 79RewriteRule ^/git/(.*/objects/pack/pack-[0-9a-f]{40}.idx)$ /git_static/$1 [PT] 80---------------------------------------------------------------- 81 82 83ENVIRONMENT 84----------- 85'git-http-backend' relies upon the CGI environment variables set 86by 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 95Author 96------ 97Written by Shawn O. Pearce <spearce@spearce.org>. 98 99Documentation 100-------------- 101Documentation by Shawn O. Pearce <spearce@spearce.org>. 102 103GIT 104--- 105Part of the linkgit:git[1] suite