Skip to content

Commit 556cfa3

Browse files
spearcegitster
authored andcommitted
Smart fetch and push over HTTP: server side
Requests for $GIT_URL/git-receive-pack and $GIT_URL/git-upload-pack are forwarded to the corresponding backend process by directly executing it and leaving stdin and stdout connected to the invoking web server. Prior to starting the backend process the HTTP response headers are sent, thereby freeing the backend from needing to know about the HTTP protocol. Requests that are encoded with Content-Encoding: gzip are automatically inflated before being streamed into the backend. This is primarily useful for the git-upload-pack backend, which receives highly repetitive text data from clients that easily compresses to 50% of its original size. Signed-off-by: Shawn O. Pearce <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 42526b4 commit 556cfa3

File tree

2 files changed

+359
-4
lines changed

2 files changed

+359
-4
lines changed

Documentation/git-http-backend.txt

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,23 @@ By default, only the `upload-pack` service is enabled, which serves
2222
This is ideally suited for read-only updates, i.e., pulling from
2323
git repositories.
2424

25+
SERVICES
26+
--------
27+
These services can be enabled/disabled using the per-repository
28+
configuration file:
29+
30+
http.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+
35+
http.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+
2542
URL TRANSLATION
2643
---------------
2744
'git-http-backend' relies on the invoking web server to perform
@@ -49,7 +66,19 @@ ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/git/
4966
</Files>
5067
----------------------------------------------------------------
5168
+
52-
To require authentication for reads, use a Directory
69+
To enable anonymous read access but authenticated write access,
70+
require 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+
+
81+
To require authentication for both reads and writes, use a Directory
5382
directive around the repository, or one of its parent directories:
5483
+
5584
----------------------------------------------------------------
@@ -92,6 +121,14 @@ by the invoking web server, including:
92121
* QUERY_STRING
93122
* REQUEST_METHOD
94123

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.
128+
129+
All CGI environment variables are available to each of the hooks
130+
invoked by the 'git-receive-pack'.
131+
95132
Author
96133
------
97134
Written by Shawn O. Pearce <[email protected]>.

0 commit comments

Comments
 (0)