Archive for the ‘ SCM ’ Category

Setting up Gitweb with Gitolite on Ubuntu 10.04 (Lucid Lynx)

As gitosis’s development seems to be no more (last release almost 3 years ago, last commit 1,5 years ago), I switched to gitolite for my repository and user management some time ago (maybe I’ll cover the switch in another post later on). But until yesterday, something was missing for me: I forgot to reconfigure gitweb! πŸ˜›

The reconfiguration was pretty straightforward. First add the apache user to the git group that is part of the ownership of the gitolite repositories:

sudo usermod -G git www-data

Restart apache so that change is applied.

Then change gitolite’s default umaks to 0027 in .gitolite.rc:

# $REPO_UMASK = 0077;         # gets you 'rwx------'
$REPO_UMASK = 0027;       # gets you 'rwxr-x---'
# $REPO_UMASK = 0022;       # gets you 'rwxr-xr-x'

For existing repositories you need to change the rights to 750 (740 should do it as well) (740 can’t obviously work with a umask of 0027! Thx Dude! ;)) from 700, so gitweb can read the repositories as well:

sudo chmod -R 750 /path/to/repositories/

And the final step is to change the gitweb configuration to point to the gitolite installation:

# path to git projects (.git)
$projectroot = "/srv/git/repositories";

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

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

# html text to include at home page
$home_text = "indextext.html";

# file with project list; by default, simply scan the projectroot dir.
#$projects_list = $projectroot;
$projects_list = "/srv/git/projects.list";

# By default, gitweb will happily let people browse any repository
# they guess the name of. This may or may not be what you want.
# I prefer to set these, to allow exactly the repositories in
# projects.list to be browsed.
$export_ok = "";
$strict_export = "true";

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

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

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

You need to make sure that gitwebs $projects_list variable has the same value as the $PROJECTS_LIST variable in gitolite.rc!

And all that’s missing now is a gitweb’bed repository! For this you need to grant the gitweb user readable rights by gitolite to the repository you want to show up in gitolite.conf.

repo foo
  R = gitweb

Save the change, commit it and push it! That’s all folks!


Change Git Author/Committer Name and eMail in the History

This happens to me all the time: I have a default and set in the global git config, but when I work on a project I sometimes must use another name. Usually I change it before my first commit, but that’s more the exception than the case. And just now I realized that I can change the commiter name/email in a working repository for all my previous commits. Awesome!! And it’s a one-liner:

git filter-branch --env-filter 'GIT_AUTHOR_NAME="pubmem";GIT_AUTHOR_EMAIL="";GIT_COMMITTER_NAME="pubmem";GIT_COMMITTER_EMAIL="";' HEAD


Don’t do this when working with git-svn! πŸ˜‰


How to setup git, gitosis and gitweb

The following how-to applies to Ubuntu-Server 10.04 (Lucid Lynx) and covers installation and configuration of git, gitosis and gitweb.


First, update apt and install all necessary programs and its dependencies: Read on…

Initial commit

Hello World πŸ˜‰