Information Technology Reference
In-Depth Information
Close ssh:
# Guest OS (Ubuntu 12.04)
$ exit
Stop the virtual machine:
# Host OS (e.g., Windows, Linux, OS X)
$ vagrant halt
How It Works
The method of hosting described in this recipe provides read-only anonymous access to
the repository
/var/www/03-01.git
. Everyone who can access the host using
HTTP protocol can clone this repository. But the clone created with HTTP, as in:
$ git clone
http://localhost/03-01.git
cannot be used to push to the original repository. HTTP allows read-only access.
If you want to host a repository over HTTP protocol in a read-only anonymous
mode you have to:
• Make the directory with the repository available through HTTP protocol
• Update the information about branches
• Createthehookthatwillupdatetheinformationaboutbrancheswithevery
push
The command
$ git update-server-info
creates a text file
.git/info/
refs
with all your branches and references. When you use HTTP protocol to access
first downloads the
.git/info/refs
. That's how the client knows about the refer-
ences in the cloned repository.
The file
.git/info/refs
has to be updated after every push. Otherwise the cli-
ent would get stale references. This is achieved with the hook stored in
.git/
hooks/post-update
. This shell script executes a single
$ git update-
server-info
command.