git
Sep 06, 2009
gitosis and virtualenv
Notes on setting up gitosis (on FreeBSD) using virtualenv.
Basically, the following is a condensed and simpler version of the excellent tutorial over at scie.nti.st, except that we don't use the system-wide site-packages. The crucial simplifications are:
- we don't muck about with $PYTHONPATH or /etc/environment because that's evil :)
- instead we use virtualenv
First, install git:
cd /usr/ports/devel/git sudo make install
Install python and friends:
cd /usr/ports/lang/python25 sudo make install ... cd /usr/ports/devel/py-setuptools sudo make install ... sudo easy_install virtualenv
Add a git user:
sudo pw adduser -n git -m
Copy the public key:
cp ~/.ssh/authorized_keys /tmp/gitosis.pub
Become the git user and install gitosis using virtualenv:
sudo su - git virtualenv . --no-site-packages mkdir src cd src/ git clone git://eagain.net/gitosis.git cd gitosis ../../bin/python setup.py install
The only thing missing now is to use absolut paths in the hook script (to make it work with virtualenv). IOW, /home/git/repositories/gitosis-admin.git/hooks/post-update should look like this:
#!/bin/sh set -e /home/git/bin/gitosis-run-hook post-update /usr/local/libexec/git-core/git-update-server-info
Make sure, the hook's executable bit is set:
chmod a+x /home/git/repositories/gitosis-admin.git/hooks/post-update
Voila! You can clone the gitosis-admin repository and start working with it.
Jan 12, 2009
Git command aliases
Not everything in svn is worse than in git!
One of the nice features of subversion are its built-in command aliases, i.e. instead of having to type svn commit you can just use svn ci, instead of propertyedit just type pe.
git doesn't have those, which some find annoying. However, you can easily remedy this by adding an [alias] section to your ~/.gitconfig file. Upon request and because it's really a nice feature here's an example for that from my own configuration. I've copied it myself mostly from Andi, who is as much more prolific than I as he is lazier to blog ;-)
Anyway, here it goes:
[core]
excludesfile = /Users/tomster/.gitignore
pager = "/opt/local/bin/less -RciqMSj5"
editor = mate -w
[color]
diff = auto
branch = auto
status = auto
[diff]
renames = true
[alias]
st = status
d = diff
ci = commit -v
cia = commit -v -a
co = checkout
cp = cherry-pick
l = log
ll = log -p
lt = log trunk..
llt = log -p trunk..
lm = log master..
llm = log -p master..
b = branch
The .gitignore file referenced above looks like this (and should look rather familiar to svn users):
.svn
*.egg-info
*.pyc
.DS_Store
tmtags
