Information Technology Reference
In-Depth Information
Hint
In this recipe we do not need to issue
$ vagrant init
because we create
the complete Vagrantfile manually.
Boot the virtual machine and open the ssh session:
$ vagrant up
$ vagrant ssh
Update the system dependencies and install the git and git-daemon-run packages:
# Guest OS (Ubuntu 12.04)
$ sudo apt-get update -y
$ sudo apt-get install -y git git-daemon-run
The script responsible to start and stop git daemon is saved as
/etc/sv/git-
daemon/run
. Open the editor:
$ sudo vi /etc/sv/git-daemon/run
And change this script as shown in
Listing 11-5
.
You need to adjust two paths
/pub
and
/pub/git
and add the
--export-all
option. The parameter
--export-
all
allows read-only access for all repositories.
Listing 11-5.
Modified script /etc/sv/git-daemon/run
#!/bin/sh
exec 2>&1
echo 'git-daemon starting.'
exec chpst -ugitdaemon \
"$(git --exec-path)"/git-daemon --verbose --reuseaddr \
--export-all \
--base-path=/pub /pub/git
Now you can restart daemon with
# Guest OS (Ubuntu 12.04)
$ sudo sv restart git-daemon