Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions book/04-git-server/sections/git-daemon.asc
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
=== Git Daemon

(((serving repositories, git protocol)))
Next we'll set up a daemon serving repositories over the ``Git'' protocol.
This is common choice for fast, unauthenticated access to your Git data.
Remember that since it's not an authenticated service, anything you serve over this protocol is public within its network.
Next we'll set up a daemon serving repositories using the ``Git'' protocol.
This is a common choice for fast, unauthenticated access to your Git data.
Remember that since this is not an authenticated service, anything you serve over this protocol is public within its network.

If you're running this on a server outside your firewall, it should only be used for projects that are publicly visible to the world.
If you're running this on a server outside your firewall, it should be used only for projects that are publicly visible to the world.
If the server you're running it on is inside your firewall, you might use it for projects that a large number of people or computers (continuous integration or build servers) have read-only access to, when you don't want to have to add an SSH key for each.

In any case, the Git protocol is relatively easy to set up.
Expand All @@ -16,7 +16,7 @@ Basically, you need to run this command in a daemonized manner:(((git commands,
$ git daemon --reuseaddr --base-path=/srv/git/ /srv/git/
----

`--reuseaddr` allows the server to restart without waiting for old connections to time out, the `--base-path` option allows people to clone projects without specifying the entire path, and the path at the end tells the Git daemon where to look for repositories to export.
The `--reuseaddr` option allows the server to restart without waiting for old connections to time out, while the `--base-path` option allows people to clone projects without specifying the entire path, and the path at the end tells the Git daemon where to look for repositories to export.
If you're running a firewall, you'll also need to punch a hole in it at port 9418 on the box you're setting this up on.

You can daemonize this process a number of ways, depending on the operating system you're running.
Expand Down Expand Up @@ -50,7 +50,7 @@ You might have noticed that Git daemon is started here with `git` as both group

Modify it to fit your needs and make sure provided user exists on the system.

Finally, you'll run `systemctl enable git-daemon` to automatically start the service on boot, and the usual service commands like `service start` and `service stop` are instantly available.
Finally, you'll run `systemctl enable git-daemon` to automatically start the service on boot, and can start and stop the service with, respectively, `systemctl start git-daemon` and `systemctl stop git-daemon`.

Until LTS 14.04, Ubuntu used upstart service unit configuration.
Therefore, on Ubuntu <= 14.04 you can use an Upstart script.
Expand All @@ -75,7 +75,7 @@ exec /usr/bin/git daemon \
respawn
----

For security reasons, it is strongly encouraged to have this daemon run as a user with read-only permissions to the repositories you can easily do this by creating a new user 'git-ro' and running the daemon as them.
For security reasons, it is strongly encouraged to have this daemon run as a user with read-only permissions to the repositories -- you can easily do this by creating a new user 'git-ro' and running the daemon as them.
For the sake of simplicity we'll simply run it as the same 'git' user that `git-shell` is running as.

When you restart your machine, your Git daemon will start automatically and respawn if it goes down.
Expand All @@ -86,7 +86,7 @@ To get it running without having to reboot, you can run this:
$ initctl start local-git-daemon
----

On other systems, you may want to use `xinetd`, a script in your `sysvinit` system, or something else as long as you get that command daemonized and watched somehow.
On other systems, you may want to use `xinetd`, a script in your `sysvinit` system, or something else -- as long as you get that command daemonized and watched somehow.

Next, you have to tell Git which repositories to allow unauthenticated Git server-based access to.
You can do this in each repository by creating a file named `git-daemon-export-ok`.
Expand Down