views:

2028

answers:

3

I want to know how to simply publish over http = much like Mercurial's hg serve! On the Windows/work box do this:

git serve 

and then on the Linux box SIMPLY go:

git clone http://project project 

finished.

+27  A: 

Navigate into your project and start git-daemon with the following switches:

cd project
git daemon --reuseaddr --base-path=. --export-all --verbose

This tells git-daemon to serve up all projects inside the current directory (which I assume is the project directory containing the .git/ folder). It also tells it to re-use the same address if you shut it down and start it back up too fast.

You can put this into a batch script with an easy to remember name like "gitserve", so you don't need to type it all out again. (or see the bottom of this answer for another approach)

Also, git-daemon uses the git:// protocol for transport, so on the linux box you need to do:

git clone git://123.456.789.111/.git project

As suggested in some of the comments; in recent versions of Git you can add an alias to the Git config, instead of using a batch script: http://git.wiki.kernel.org/index.php/Aliases#Serve_repo_on_the_spot

seanhodges
oh yes you amazing person thank you
Setori
You can add the command as an alias to you .gitconfig file as described here: http://git.or.cz/gitwiki/Aliases#Serverepoonthespot
RFelix
that should behttp://git.wiki.kernel.org/index.php/Aliases#Serve_repo_on_the_spot
Aeon
+9  A: 

Rather than write your own batch script, use gitjour. It knows how to start git daemon correctly and will broadcast the clone URL via mDNS so you can do gitjour show on the linux box and copy and paste.

Also a good article with an overview of gitjour and a number of other similar tools from Dr. Nic, What is *jour and why they are killer apps for RailsCamp08.

Otto
+1 for bringing gitjour to my attention.
Abizern
Looks very useful. Thanks.
Paul
Definitely gitjour.
dylanfm
A: 

If you start git deamon in background mode, it may not work with --verbose option.

Dziamid