Home Explore Blog CI



git

1st chunk of `Documentation/git-http-backend.adoc`
2b91f5d44a4a15500d0f63f6356e68d9a2c940b644c249250000000100000fa0
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.
The program supports clients fetching using both the smart HTTP protocol
and the backwards-compatible dumb HTTP protocol, as well as clients
pushing using the smart HTTP protocol. It also supports Git's
more-efficient "v2" protocol if properly configured; see the
discussion of `GIT_PROTOCOL` in the ENVIRONMENT section below.

It verifies that the directory has the magic file
"git-daemon-export-ok", and it will refuse to export any Git directory
that hasn't explicitly been marked for export this way (unless the
`GIT_HTTP_EXPORT_ALL` environment variable is set).

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'.  If the client is authenticated,
the `receive-pack` service is enabled, which serves 'git send-pack'
clients, which is invoked from 'git push'.

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

http.getanyfile::
	This serves Git clients older than version 1.6.6 that are unable to use the
	upload pack service.  When enabled, clients are able to read
	any file within the repository, including objects that are
	no longer reachable from a branch but are still present.
	It is enabled by default, but a repository can disable it
	by setting this configuration value to `false`.

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 value 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`.

http.uploadarchive::
	This serves 'git archive' clients for remote archive over HTTP/HTTPS
	protocols. It is disabled by default. It only works in protocol v2.

URL TRANSLATION
---------------
To determine the location of the repository on disk, 'git http-backend'
concatenates the environment variables PATH_INFO, which is set
automatically by the web server, and GIT_PROJECT_ROOT, which must be set
manually in the web server configuration.  If GIT_PROJECT_ROOT is not
set, 'git http-backend' reads PATH_TRANSLATED, which is also set
automatically by the web server.

EXAMPLES
--------
All of the following examples map `http://$hostname/git/foo/bar.git`
to `/var/www/git/foo/bar.git`.

Apache 2.x::
	Ensure mod_cgi, mod_alias, and mod_env are enabled, set
	GIT_PROJECT_ROOT (or DocumentRoot) appropriately, and
	create a ScriptAlias to the CGI:
+
----------------------------------------------------------------
SetEnv GIT_PROJECT_ROOT /var/www/git
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/

# This is not strictly necessary using Apache and a modern version of
# git-http-backend, as the webserver will pass along the header in the
# environment as HTTP_GIT_PROTOCOL, and http-backend will copy that into
# GIT_PROTOCOL. But you may need this line (or something similar if you
# are using a different webserver), or if you want to support older Git
# versions that did not do that copying.
#
# Having the webserver set up GIT_PROTOCOL is perfectly fine even with
# modern versions (and will take precedence over HTTP_GIT_PROTOCOL,
# which means it can be used to override the client's request).
SetEnvIf Git-Protocol ".*" GIT_PROTOCOL=$0
----------------------------------------------------------------
+
To enable anonymous read access but

Title: Git HTTP Backend Documentation
Summary
The git-http-backend is a server-side implementation of Git over HTTP, allowing Git clients to access repositories over http and https protocols, with support for smart and dumb HTTP protocols, as well as Git's v2 protocol.