If you ask google how to share a git repository, you will end up with lots of recipes to setup gitweb or apache to get it done.
However, if you only use git on your side quests, it looks like too much work to share a simple directory. 😉
So, here Git-daemon comes to action. Git-daemon is git’s built in repository server.
Say we started a new repository to write a user manual, for example:
> mkdir -p /home/henrique/manual
> cd ~/manual
> git init
Then, after we wrote a draft, let’s say we need a colleague to take a look at it and express his opinions making the proper changes to the text.
For this, we need to commit our draft and then make our repository accessible through the local network:
> git daemon --verbose --export-all --enable=upload-pack --enable=receive-pack --base-path=/home/henrique /home/henrique/manual/.git
So now we can tell our colleague to clone the repository:
> git clone git://myip-or-hostname/manual/.git manual
Be aware that –enable=receive-pack allows anonymous push into your repository. So use it only in a friendly environment, like your company’s LAN.
You can learn more about git-daemon reading the manual:
> git help daemon