More fights with Gitweb and Dreamhost
Time to setup gitweb on a Dreamhost hosted domain. Incredible number of headaches:
First, I didn’t had a copy of gitweb on my $HOME there, so I decided to download the latest version and install it, following most of my previous install.
Git worked fine on Dreamhost, so I created the repository directory, initialized the git repo there and tried to push from my local repo to the server repo. That’s when I got my first “couldn’t find libcurl.so.4″. At first, I thought the problem was happening ’cause I was running Git 1.5 on my laptop and 1.6 on Dreamhost, but upgrading my local install didn’t solve the problem. Even, I have “libcurl.so.4″ on my local files directory there. That’s when I found out that .bash_profile is not sourced when using SSH. Copying the contents of .bash_profile to .bashrc made git push happy again.
Just dropping gitweb.cgi on the domain directory didn’t work: I got a “404 - No projects found”. Hunting in the web I found that you need to add a gitweb-config.pl with the gitweb.cgi. The contents should look something like this:
# where's the git binary?
$GIT = "/home/slowsloth/packages/bin/git";
# where's our projects?
$projectroot = "/home/slowsloth/git.deadbraincells.org/";
# what do we call our projects in the ui?
$home_link_str = "home";
# where are the files we need for web display?
@stylesheets = ("/gitweb.css");
$logo = "/git-logo.png";
$favicon = "/favicon.png";
# what do we call this site
$site_name = "DeadBrainCells' Git Repository";
# these variables should be empty
$site_header = "";
$home_text = "";
$site_footer = "";
$projects_list = "";
$export_ok = "";
$strict_export = "";
# some other config variables I found around
$projects_list_description_width = 50;
$project_maxdepth = 10;
Well, thing is, it didn’t work (and I still got “404 - No projects found”. Then I decided to read the gitweb.cgi source and found that the name for the config file is, actually, gitweb_config.perl. Renaming it removed the “404″s, but it won’t display any projects.
After changing a few values with no result, I decided to check the apache error logs to see if there was something there. And there was. Again, the message about not finding the “libcurl.so.4″. I tried to add an .htaccess with SetEnv LD_LIBRARY_PATH “/home/slowsloth/packages/lib”, which didn’t work. Then, change the $GIT on the config file to $GIT = “LD_LIBRARY_PATH=/home/slowsloth/packages/lib /home/slowsloth/packages/bin/git”, but it also didn’t work (now complaining about not finding the command.) The last resort was create a small wrapper around git, which I called gitwrap.sh:
#!/bin/sh
export LD_LIBRARY_PATH=/home/slowsloth/packages/lib
/home/slowsloth/packages/bin/git $*
The final step was replace the $GIT to call gitwrap.sh instead of git and voilà, gitweb running.
