using git as a trac versioning system backend

In keeping with the theme of installing and running trac within your $HOME directory, heres how i installed the git plugin.

Ensure ~/.pydistutils.cfg looks something like

[easy_install]
install_dir = /home/$USERNAME/lib/python2.5/site-packages
Substitute $USERNAME for your username ofcourse.

Checkout gitplugin from svn and install

$ cd ~/src
$ svn checkout http://trac-hacks.org/svn/gitplugin
$ cd gitplugin/0.11
$ export PYTHONPATH=~/lib/python2.5/site-packages:$PYTHONPATH
$ python setup.py install
Your trac projects conf/trac.ini file will need the following
[components]
tracext.git.* = enabled

[trac]
repository_dir = $GIT_REPOSITORY_PATH
repository_type = git

[git]
cached_repository = true
persistent_cache = true
shortrev_len = 6
git_bin = /usr/bin/git
Where $GIT_REPOSITORY_PATH is the absolute path to your git repository.

If you're using modpython and Apache to serve trac to the world you will need to update your PythonPath within your apache configuration files to resemble something like

    PythonPath "sys.path +  \ 
          ['/home/$USERNAME/lib/python2.5/site-packages/Trac-0.11b2-py2.5.egg/'] +  \
          ['/home/$USERNAME/lib/python2.5/site-packages/TracGit-0.11.0.1-py2.5.egg']"
trac should now be able to use git as a versioning system backend.

When creating a new project within trac using trac-admin and initenv, specifying git and your git repository as your chosen repository will work after a bit of config tuning. You may receive the error which can be ignored.

Warning:

Repository type git not supported
I had to tune the following parameters in conf/trac.ini to the parameters with the ones above to get things working with git.

Go git it.

I'm encountering "GIT control files not found" error

Hi all…I seem to have gotten everything working similarly, though not exactly, as above, yet I'm still encountering this odd error:

"GitError: GIT control files not found, maybe wrong directory?"

Strange this is, I've tried every possible permutation for repistory_dir that I can think of, both pointing to the directory containing the .git/ directory and pointing to the .git itself. No luck. Any tips you think might help? They'd be much appreciated.

Thanks!

Meiter, Does the user who is

Meiter,

Does the user who is running apache (in the case of debian/ubuntu its www-data) have read and execute permissions on the git repository?

You could test this by running something like

# sudo su - www-data
$ cd $YOUR_GIT_REPOSITORY
$ ls -la

--
Rene

Daniel, If you're using

Daniel, If you're using modpython ensure that it is built against python 2.5. You can do this by setting up the mod_python.testhandler with something like this in your apache config.
<Location /mpinfo>
   SetHandler mod_python
   PythonInterpreter main_interpreter
   PythonHandler mod_python.testhandler
</Location>
And then going to /mpinfo in your web browser. If modpython is built against 2.4, which you will find in Debian Etch, you will need to downgrade to Trac 0.10.3 and need to use the 0.10 version of the git trac plugin. Also when you built the gitplugin with 'python setup.py install' you may have seen some errors complaining that you're running python 2.4 and not 2.5.

Hello, Apache2 was using

Hello,

Apache2 was using modpython for python2.4 and I installed the newest verion and compiled it to use python2.5, and I've compiled and installed clearsilver for python2.5 too. (I've spend a lot of time trying to do this things, almost giving up...)
Now I'm getting the error: Warning: Can't synchronize with the repository (GIT backend not available)

Some idea?

Make sure you have set

Make sure you have set git_bin in your trac.ini to the full path of your git binary.

git_bin = /usr/bin/git

That's what solved it here.

Daniel, If you're going to

Daniel,

If you're going to use gitplugin 0.11 you will need git version 1.5.2+ as stated on http://trac-hacks.org/wiki/GitPlugin.

Also make sure that repository_dir within the [trac] stub of your trac.ini conf file is pointing to a git repository that the Apache user (www-data on debian) can read from.

Hello, I'm trying for some

Hello,

I'm trying for some days to run trac with git and had followed several tutorial but nothing still yet.
I found your explanations very usefull (mostly the part of installing it on $HOME), but I did everything you said about the GIT configurantion and I'm getting the error:
Warning: Can't synchronize with the repository (Unsupported version control system "git". Check that the Python support libraries for "git" are correctly installed.)
Trac Error

Unsupported version control system "git". Check that the Python support libraries for "git" are correctly installed.

Here is how my trac.config is:
[trac]
repository_dir = /home/kossmann/temp/teste/.git
repository_type = git

[git]
cached_repository = true
persistent_cache = true
shortrev_len = 6
git_bin = /usr/bin/git

[components]
# for plugin version 0.10
# gitplugin.* = enabled

# for plugin version 0.11.0.1+
tracext.git.* = enabled

--------------
The only thing I did different was that I changed the trac installation directory to ~/trac (I changed all the commands that referred to the original path).

Could you give me some help?

Thanks,
Daniel Kossmann

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

Captcha
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
- nine = zero
Solve this math question and enter the solution with digits. E.g. for "two plus four = ?" enter "6".