Home Explore Blog CI



git

5th chunk of `Documentation/git-daemon.adoc`
ccbfa02ed46f6563618683de4469207e8bb976d0c66faa0c0000000100000c68
 is _no_
	authentication in the protocol (in other words, anybody
	can push anything into the repository, including removal
	of refs).  This is solely meant for a closed LAN setting
	where everybody is friendly.  This service can be
	enabled by setting `daemon.receivepack` configuration item to
	`true`.

EXAMPLES
--------
We assume the following in /etc/services::
+
------------
$ grep 9418 /etc/services
git		9418/tcp		# Git Version Control System
------------

'git daemon' as inetd server::
	To set up 'git daemon' as an inetd service that handles any
	repository within `/pub/foo` or `/pub/bar`, place an entry like
	the following into `/etc/inetd` all on one line:
+
------------------------------------------------
	git stream tcp nowait nobody  /usr/bin/git
		git daemon --inetd --verbose --export-all
		/pub/foo /pub/bar
------------------------------------------------


'git daemon' as inetd server for virtual hosts::
	To set up 'git daemon' as an inetd service that handles
	repositories for different virtual hosts, `www.example.com`
	and `www.example.org`, place an entry like the following into
	`/etc/inetd` all on one line:
+
------------------------------------------------
	git stream tcp nowait nobody /usr/bin/git
		git daemon --inetd --verbose --export-all
		--interpolated-path=/pub/%H%D
		/pub/www.example.org/software
		/pub/www.example.com/software
		/software
------------------------------------------------
+
In this example, the root-level directory `/pub` will contain
a subdirectory for each virtual host name supported.
Further, both hosts advertise repositories simply as
`git://www.example.com/software/repo.git`.  For pre-1.4.0
clients, a symlink from `/software` into the appropriate
default repository could be made as well.


'git daemon' as regular daemon for virtual hosts::
	To set up `git daemon` as a regular, non-inetd service that
	handles repositories for multiple virtual hosts based on
	their IP addresses, start the daemon like this:
+
------------------------------------------------
	git daemon --verbose --export-all
		--interpolated-path=/pub/%IP/%D
		/pub/192.168.1.200/software
		/pub/10.10.220.23/software
------------------------------------------------
+
In this example, the root-level directory `/pub` will contain
a subdirectory for each virtual host IP address supported.
Repositories can still be accessed by hostname though, assuming
they correspond to these IP addresses.

selectively enable/disable services per repository::
	To enable `git archive --remote` and disable `git fetch` against
	a repository, have the following in the configuration file in the
	repository (that is the file 'config' next to `HEAD`, 'refs' and
	'objects').
+
----------------------------------------------------------------
	[daemon]
		uploadpack = false
		uploadarch = true
----------------------------------------------------------------


ENVIRONMENT
-----------
`git daemon` will set `REMOTE_ADDR` to the IP address of the client
that connected to it, if the IP address is available. `REMOTE_ADDR` will
be available in the environment of hooks called when
services are performed.

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

Title: Git Daemon Configuration and Examples
Summary
The text provides examples of setting up git daemon as an inetd server and as a regular daemon for handling repositories, including configurations for virtual hosts and IP addresses, as well as selectively enabling or disabling services per repository, and discusses environment variables and integration with other Git tools.