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/”, etc and they all failed. I found the “–start” suggestion on
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.

To stop the process, just exchange “–start” with “–stop”

git instaweb -d webrick --stop

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.


Related Articles:

Post Footer automatically generated by Add Post Footer Plugin for wordpress.

About Jason Meridth

Continuously learning software developer trying to not let best be the enemy of better
This entry was posted in git. Bookmark the permalink. Follow any comments here with the RSS feed for this post.

3 Responses to git instaweb

  1. Joe Ocampo says:

    You can simply add this to your .gitconfig


    The ‘open’ command is for safari.

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

    git instaweb –stop

  2. This is very good and informative site.