Tuesday, August 31, 2010

How to run git daemon (quick 'n dirty)

First, I assume you have installed git and know how to clone a project from a repository.

Create a directory where you'll keep all your projects to be cloned and go into that directory. For example, we could call our repository trunk "MyRepoFolder".
#mkdir MyRepoFolder

Now, the first thing to do is clone a bare git repository. With bare I mean a clean repo without a working tree like modified files, staged files etc. To get this, we do as follows:
# git clone --bare ~/Development/CProject/myproject/ myproject.git

Next, we create a magic file "git-daemon-export-ok" in the project's directory.
# touch myproject.git/git-daemon-export-ok

Finally you can start the daemon, in my case it would be:
#git daemon --verbose --base-path=/home/nordin/MyRepoFolder

With the --verbose option you activate some loggings to stdout, so you can see if it works when you clone myproject from another pc.

If you want to clone "myporject.git" from another Linux pc, you should do as follows:
#git clone git://my.machine.ip.address/myproject.git

If this works, you can focus on the tweakings and other detailed stuff. But that's up to you :)

No comments:

Post a Comment

NSNotification example