Skip to content

Commit

Permalink
Smart fetch and push over HTTP: server side
Browse files Browse the repository at this point in the history
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 <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Shawn O. Pearce authored and Junio C Hamano committed Nov 5, 2009
1 parent 42526b4 commit 556cfa3
Show file tree
Hide file tree
Showing 2 changed files with 359 additions and 4 deletions.
39 changes: 38 additions & 1 deletion Documentation/git-http-backend.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,23 @@ By default, only the `upload-pack` service is enabled, which serves
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
Expand Down Expand Up @@ -49,7 +66,19 @@ ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/git/
</Files>
----------------------------------------------------------------
+
To require authentication for reads, use a Directory
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:
+
----------------------------------------------------------------
Expand Down Expand Up @@ -92,6 +121,14 @@ by the invoking web server, including:
* 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>.
Expand Down
Loading

0 comments on commit 556cfa3

Please sign in to comment.