posts:one-off-git-daemon: Add a git://192.168.1.2/ example
[blog.git] / posts / One-off_Git_daemon.mdwn
1 In my [[gitweb]] post, I explain how to setup `git daemon` to serve
2 `git://` requests under [[Nginx]] on [[Gentoo]].  This post talks
3 about a different situation, where you want to toss up a Git daemon
4 for collaboration on your LAN.  This is useful when you're teaching
5 Git to a room full of LAN-sharing students, and you don't want to
6 bother setting up public repositories more permanently.
7
8 Say you have a repository that you want to serve:
9
10     $ mkdir -p ~/src/my-project
11     $ cd ~/src/my-project
12     $ git init
13     $ …hack hack hack…
14
15 Fire up the daemon (probably in another terminal so you can keep
16 hacking in your original terminal) with:
17
18     $ cd ~/src
19     $ git daemon --export-all --base-path=. --verbose ./my-project
20
21 Then you can clone with:
22
23     $ git clone git://192.168.1.2/my-project
24
25 replacing `192.168.1.2` with your public IP address (e.g. from `ip
26 addr show scope global`).
27
28 If you don't want to bother listing `my-project` in your URLs, you can
29 base the daemon in the project itself (instead of in the parent
30 directory):
31
32     $ cd
33     $ git daemon --export-all --base-path=src/my-project --verbose
34
35 Then you can clone with:
36
37     $ git clone git://192.168.1.2/
38
39 This may be more convenient if you're only sharing a single
40 repository.
41
42
43 [[!tag tags/linux]]
44 [[!tag tags/tools]]