I wanted to do a similar thing, in my case I was looking for an easy way to synchronise a project on an embedded system (running Linux). Previously I just setup a shared internet connection and pulled from the centralised repository. But I didn't find it easy to work like this, and sometimes my internet connection is just poor.
In the following article the use of git daemon
is explained very nicely to solve this problem. I'll just put a brief copy of the contents here:
http://railsware.com/blog/2013/09/19/taming-the-git-daemon-to-quickly-share-git-repository/
Setup the following aliases for read access (serve) or read/write access (hub) to your repositories:
$ git config --global alias.serve "!git daemon --base-path=. --export-all --reuseaddr --informative-errors --verbose"
$ git config --global alias.hub "!git daemon --base-path=. --export-all --enable=receive-pack --reuseaddr --informative-errors --verbose"
Then on the host just execute git serve
or git hub
from the directory where the repositories you want to share reside. Now on the client one can execute git clone git://x.x.x.x/path/to/repo
to access the local repository on the host!
For windows users:
- Use double quotes in the commands to setup the aliases
- Be sure to 'hang' the command-prompt for it to not output any line by right clicking on the title bar and choosing Edit->Mark. Otherwise connections to clients might be interrupted due to a bug in git (according to a comment in the blog post).