Yaws and gitweb

klacke edited this page Sep 13, 2010 · 1 revision

Gitweb is a CGI script for browsing git repositories.

On Debian you have /etc/gitweb.conf to look into. Assume you setup the file like this:

# - - - - - - - 
# path to git projects (<project>.git)
$projectroot = "/var/cache/git";

# directory to use for temp files
$git_temp = "/tmp";

# target of the home link on top of all pages
$home_link = "/gitweb";

# html text to include at home page
$home_text = "Tobbes Git Projects";

# file with project list; by default, simply scan the projectroot dir.
#$projects_list = $projectroot;

# stylesheet to use
$stylesheet = "/gitweb.css";

# logo to use
$logo = "/git-logo.png";

# the 'favicon'
$favicon = "/git-favicon.png";
# - - - - - - 


Make sure to copy the stylesheet and png’s to your Docroot top directory.

Then assume you configure your yaws.conf with:

# - - - - - - 
ebin_dir = YOUR_DIR_HERE/www/gitweb/ebin
...
# In the server block
  ...
  appmods = <gitweb , gitweb>
  ...
# - - - - - - 

Create a directory: …/www/gitweb and …/www/ebin. Compile the following Erlang code and put it under the ebin dir.


%%% - - - - - - 
-module(gitweb).
-export([out/1]).

%%% Compile:  erlc -I /usr/local/lib -o ebin gitweb.erl

-include_lib("yaws/include/yaws_api.hrl").

out(Arg) ->
   Pathinfo = Arg#arg.appmoddata,
   Env = [],
   yaws_cgi:call_cgi(Arg, undefined, script(), Pathinfo, Env).

script() ->
   "/usr/lib/cgi-bin/gitweb.cgi".
%%% - - - - - - - 

Check that the path to gitweb.cgi is correct.

Finally, in the /var/cache/gitweb directory, make a link pointing to you git project:


ln -s ~tobbe/git/eblog/.git /var/cache/git/eblog.git

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.