Los Techies : Blogs about software and anything tech!

git instaweb


I was reading "Pro Git" by Scott Chacon and was on the section about "git instaweb". This is where you can run gitweb, a cgi script that comes with git, locally or on a server. I have successfully gotten gitweb up for my personal git repos on my remote server. I use it all the time. I was curious if I could get it working locally, for friends who prefer a visual tool to see their git logs, commits, etc. I cd into a local repo (you have to cd into the .git folder of the app to get the desired view):

cd /code/app/.git

and run the instaweb command (note: I'm on a macbook pro that already has ruby installed, hence my choice of using webrick instead of the default lighttpd):

git instaweb -d webrick --start

I tried the command without the "--start" command and it kept trying to seek a browser. I tried "-b firefox", "-b Firefox", "-b /Application/Firefox.app/MacOS/firefox-bin", etc and they all failed. I found the "--start" suggestion on StackOverflow.com Once I ran this command, I could see the git log, commits, diffs, etc in gitweb for my local changes. What this will do is run the daemon on port 1234 of localhost. If you open your browser of choice and go to http://localhost:1234 then you will see gitweb for the git repository you ran the command in. The catch: you will have to stop the process manually. On my macbook, I ran the following command:

kill -9 `ps -aux | grep webrick | grep -v grep | awk '{print $2}'`

This will pass the id of the local process running webrick to "kill -9" and kill the process. ("grep -v grep" excludes the grep command you just ran from the processes returned in the ps query) Note: I personally use "git log --graph", gitk, gitx, or other tools for this, usually. Just thought it was a good addition to my git toolset.

Kick It on DotNetKicks.com
Posted Sep 26 2009, 08:53 PM by Jason Meridth
Filed under:

Comments

Twitter Trackbacks for git instaweb - Jason Meridth - Los Techies : Blogs about software and anything tech! [lostechies.com] on Topsy.com wrote Twitter Trackbacks for git instaweb - Jason Meridth - Los Techies : Blogs about software and anything tech! [lostechies.com] on Topsy.com
on 09-28-2009 12:24 PM

Pingback from  Twitter Trackbacks for                 git instaweb - Jason Meridth - Los Techies : Blogs about software and anything tech!         [lostechies.com]        on Topsy.com

Joe Ocampo wrote re: git instaweb
on 10-09-2009 9:07 AM

You can simply add this to your .gitconfig

[instaweb]

   httpd=webrick

   port=4000

   browser=open

The 'open' command is for safari.

OH and to stop instaweb all you have to do is use the following command:

git instaweb --stop

Jason Meridth wrote re: git instaweb
on 10-09-2009 9:16 AM

@Joe

Thanks.

duplicate mp3 finder wrote re: git instaweb
on 10-30-2009 8:53 AM

This is very good and informative site.

Copyright Los Techies 2008, 2009. All rights reserved.
Powered by Community Server (Commercial Edition), by Telligent Systems