Random Brain dump – Trac 0.11 with Git on Debian Lenny; this worked for me …
We’ll use /var/git/ as the location where our git repositories live – e.g. /var/git/repository1, /var/git/repository2 etc.
So, assuming you have git-core installed, create the Git repository:
mkdir -p /var/git/repository
cd /var/git/repository
git init –bare
Next, install the trac-git extension so trac can do ‘git’ like things:
apt-get install trac-git
Ensure the WebDAV FS module is enabled in Apache:
a2enmod dav_fs
And Expose where the Git repository is on the web server – e.g.
cd /var/www
ln -s /var/git git
And add something like :
<Location /git> DAV on </Location>
Next, let’s create the Trac Repository:
trac-admin /var/trac/repository initenv \
repository sqlite:db/trac.db git /var/git/repository
Configure Trac to do Git things:
Edit /var/trac/repository/conf/trac.ini and make sure it contains something like :
[components]
tracext.git.* = enabled
[git]
cached_repository = false
git_bin = /usr/bin/git
persistent_cache = false
shortrev_len = 7
Finally, just make sure permissions are correct:
chown -R www-data /var/trac/repository
chown -R www-data /var/git/repository
Then finally, restart Apache, point your web browser at the trac repository (assuming you’ve already setup Trac via e.g mod_python or similar) and you’ll probably seen an AssertionFailed error (with no helpful message). This seems to be a one off when the repository is empty… so try :
mkdir ~/src/tmp
cd ~/src/tmp
git init
echo 'test' > hello.txt
git add hello.txt
git commit
git config remote.upload.url https://user@remote.host/git/repository/
git push upload master
(If this fails with some unhelpful message like :
orange:~/src/tmp $ git push upload master .... error: Cannot access URL https://david@remote.host/git/repository/,
return code 60 error: failed to push some refs to
'https://david@remote.host/git/repository/'