Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git-http-backend.txt « Documentation - git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 022a2433a86a1939435b5d76a95daf39ff0a32e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
git-http-backend(1)
===================

NAME
----
git-http-backend - Server side implementation of Git over HTTP

SYNOPSIS
--------
[verse]
'git-http-backend'

DESCRIPTION
-----------
A simple CGI program to serve the contents of a Git repository to Git
clients accessing the repository over http:// and https:// protocols.

By default, only the `upload-pack` service is enabled, which serves
'git-fetch-pack' and 'git-ls-remote' clients, which are invoked from
'git-fetch', 'git-pull', and 'git-clone'.

This is ideally suited for read-only updates, i.e., pulling from
git repositories.

SERVICES
--------
These services can be enabled/disabled using the per-repository
configuration file:

http.uploadpack::
	This serves 'git-fetch-pack' and 'git-ls-remote' clients.
	It is enabled by default, but a repository can disable it
	by setting this configuration item to `false`.

http.receivepack::
	This serves 'git-send-pack' clients, allowing push.  It is
	disabled by default for anonymous users, and enabled by
	default for users authenticated by the web server.  It can be
	disabled by setting this item to `false`, or enabled for all
	users, including anonymous users, by setting it to `true`.

URL TRANSLATION
---------------
'git-http-backend' relies on the invoking web server to perform
URL to path translation, and store the repository path into the
PATH_TRANSLATED environment variable.  Most web servers will do
this translation automatically, resolving the suffix after the
CGI name relative to the server's document root.

EXAMPLES
--------

Apache 2.x::
	To serve all Git repositories contained within the '/git/'
	subdirectory of the DocumentRoot, ensure mod_cgi and
	mod_alias are enabled, and create a ScriptAlias to the CGI:
+
----------------------------------------------------------------
ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/git/

<Directory /usr/libexec/git-core>
	Options None
</Directory>
<Files /usr/libexec/git-core/git-http-backend>
	Options ExecCGI
</Files>
----------------------------------------------------------------
+
To enable anonymous read access but authenticated write access,
require authorization with a LocationMatch directive:
+
----------------------------------------------------------------
<LocationMatch ".*/git-receive-pack$">
	AuthType Basic
	AuthName "Git Access"
	Require group committers
	...
</LocationMatch>
----------------------------------------------------------------
+
To require authentication for both reads and writes, use a Directory
directive around the repository, or one of its parent directories:
+
----------------------------------------------------------------
<Directory /var/www/git/private>
	AuthType Basic
	AuthName "Private Git Access"
	Require group committers
	...
</Directory>
----------------------------------------------------------------

Accelerated static Apache 2.x::
	Similar to the above, but Apache can be used to return static
	files that are stored on disk.	On many systems this may
	be more efficient as Apache can ask the kernel to copy the
	file contents from the file system directly to the network:
+
----------------------------------------------------------------
DocumentRoot /var/www

ScriptAlias /git/        /usr/libexec/git-core/git-http-backend/git/
Alias       /git_static/ /var/www/git/

RewriteEngine on
RewriteRule ^/git/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$    /git_static/$1 [PT]
RewriteRule ^/git/(.*/objects/pack/pack-[0-9a-f]{40}.pack)$ /git_static/$1 [PT]
RewriteRule ^/git/(.*/objects/pack/pack-[0-9a-f]{40}.idx)$  /git_static/$1 [PT]
----------------------------------------------------------------


ENVIRONMENT
-----------
'git-http-backend' relies upon the CGI environment variables set
by the invoking web server, including:

* PATH_TRANSLATED
* REMOTE_USER
* REMOTE_ADDR
* CONTENT_TYPE
* QUERY_STRING
* REQUEST_METHOD

The backend process sets GIT_COMMITTER_NAME to '$REMOTE_USER' and
GIT_COMMITTER_EMAIL to '$\{REMOTE_USER}@http.$\{REMOTE_ADDR\}',
ensuring that any reflogs created by 'git-receive-pack' contain some
identifying information of the remote user who performed the push.

All CGI environment variables are available to each of the hooks
invoked by the 'git-receive-pack'.

Author
------
Written by Shawn O. Pearce <spearce@spearce.org>.

Documentation
--------------
Documentation by Shawn O. Pearce <spearce@spearce.org>.

GIT
---
Part of the linkgit:git[1] suite