HowTo Build a Git Ad-Hoc Repository

Git Aliases - a rarely used gem of Git.

A cool example: Launch a one-off git server from any local repository.

With the alias it is possible to serve a local GIT_HOST:

$ git serve
[50248] Ready to rumble

Once your Git host is Ready to rumble you can access the ad-hoc repository from other hosts in the network:

$ git clone git://${GIT_HOST}/ example
Cloning into 'example'...
remote: Counting objects: 319, done.
remote: Compressing objects: 100% (195/195), done.
remote: Total 319 (delta 116), reused 155 (delta 41)
Receiving objects: 100% (319/319), 124.14 KiB | 0 bytes/s, done.
Resolving deltas: 100% (116/116), done.
Checking connectivity... done.

Git it done.

Just for the record - I created the alias like this:

git config --global alias.serve '!git daemon --verbose --export-all --base-path=.git --reuseaddr --strict-paths .git/'

BONUS: Share with write access into current branch.

$ git config --global alias.serve-rw '!git daemon --verbose --export-all --base-path=.git --reuseaddr --strict-paths --enable=receive-pack .git/'
$ git config receive.denyCurrentBranch ignore