Wednesday, July 28, 2010

Git instaweb

I'm not a git user actually, not seriously. But for 'unknown' reason, I decided to use git for this one project. Maybe because it is a drupal project and currently on path of migration to git from cvs.

Using mercurial, it's easy to browse your current repo through a web interface. Just type "hg serve" inside your repo would launch a local python web server that you can use to browse the repo with browser. Git also come with gitweb but the last time I look at it, you have to configure your apache to run the Perl cgi script. I want to avoid that and I look around for alternatives. Something in PHP would be good but none seem to be usable enough. So I take a look back at gitweb and through reading the documentation I found out that git now also provide "git instaweb" command that would launch web server to serve the current repo using gitweb interface. This is much like "hg serve" and I'm glad that git now also has it.

"git instaweb" by default would use lighttpd for the httpd daemon but you can supply alternate httpd daemon such as apache. For apache, "git instaweb -l --http "apache2 -f" would start the server and launch your default browser to browse the repo. You can also put this into .git/config:-

local = true
httpd = apache2 -f
port = 4321
browser = google-chrome

No comments: