Version 31 (modified by anonymous, 7 years ago) (diff)


Git Plugin for Trac


This is yet another plugin for Trac 0.10/0.11 which enables GIT to be used instead of Subversion for the trac:VersioningSystemBackend


  • Browsing source code in a Git repository via the TracBrowser
  • Viewing the change history of a file or directory using TracRevisionLog
  • Performing diffs between any two files or two directories
  • Displaying submitted changes in the TracTimeline (0.11)
  • (Optionally) caching TracChangeset information in Trac's database (0.11)
  • Caching Git commit relation graph in memory (0.11)
  • Using the TracSearch page to search change descriptions (0.11)
  • Annotation support, also known as "blame" operation (0.11)
  • Interpretation of 40-character wide hex-strings as sha1 commit checksums
  • ...


0.10 Plugin 0.11 Plugin
Trac 0.10.x 0.11.x
Python 2.4+ 2.5
GIT 1.4.4+ 1.5.2+

Example Sites

Bugs/Feature Requests

As this is for now just a proof of concept implementation, it has quite some deficiencies, some of which exist as tickets already:

Improve performance of GitPlugin
It should be possible to see the branch in the timeline and for each changeset
shortrev_len does not work
Cannot detect GIT version: All git commands result in git usage output which is unparsable.
Enhance Documentation
Resetting HEAD on a remote branch causes GitPlugin to complain of missing changeset
UnicodeDecodeError on UTF-8 encoded filenames
Internal error if ticket text references SVN-like revision number (changeset)
GitError: GIT control files not found, maybe wrong directory?
post-receive hook is not working when default repository is speciefied
Browse branches as virtual top-level folders
File rename not supported
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 5-7: invalid data
Can't install plugin properly.
Browse with 'bare' repository fails
Invalid changeset link in ticket comments is produced by the post-receive-hook for multiple git repositories
filedescriptor out of range
Trac[git_fs] ERROR: GitError: Could not retrieve GIT version
Problem with Trac 0.12.2 and GitPlugin (BrowserModule)
Browse Source defaults to HEAD, I'd like to be able to specify a branch instead
PyGIT._get_branches fails with ValueError on commit messages with line feeds
missing links in messages
«No changeset HEAD in the repository»
Support for submodules in source browsing
Problem with cyrillic file name. (UnicodeDecodeError: 'utf8' codec can't decode)
git post-receive hook - remote: error: command not found
TypeError: 'NoneType' object is not subscriptable
GitPlugin not loading, error in
'Popen' object has no attribute 'terminate'
Source browser fails with SMB hosted git repository
WindowsError: (5, 'Access is denied')
GitPlugin crashed under Win7 while using cygwin
OSError: [Errno 10] No child processes
GitNode *must* throw NoSuchNode on invalid revisions for Bitten to work
GitPlugin on Trac 0.12 with Python 2.4
some problem with TRAC 0.12 and GIT (Apple Git-33)
TypeError: execv() arg 2 must contain only strings

...and other potential issues/todos which aren't ticket-tracked yet:

  • does not highlight sha1sums automatically
  • issues with filenames containing newlines (seems to be a Trac bug)
  • ...

Existing bugs and feature requests for GitPlugin are here (all including closed ones are here).

If you have any issues, create a new ticket.

Download, Source

Download the zipped source, check out GitPlugin from Subversion, or browse the source.

(An experimental branch of this plugin with a hacky caching feature and some bug fixes is available from here.)


Simply point your Trac instance to a local git repository:

repository_dir = /var/git/Test.git
repository_type = git

## the following is only for the 0.11 branch
## let Trac cache meta-data via CachedRepository wrapper; default: false
cached_repository = true

## disable automatic garbage collection for in-memory commit-tree cache; default: false
persistent_cache = true

## length revision sha-sums should be tried to be abbreviated to (must be >= 4 and <= 40); default: 7
shortrev_len = 6

## executable file name (optionally with path) of git binary; default: 'git'
git_bin = /usr/src/git-dev/git

/!\ NOTE: the Test.git above needs to be the .git repository directory (i.e. the one containing the file HEAD and config), not the working tree directory that holds the .git/ folder.

If installed globally, don't forget to enable the plugin:

# for plugin version 0.10
gitplugin.* = enabled

# for plugin version
tracext.git.* = enabled 

Recent Changes

[7757] by hvr on 2010-03-07 18:16:57
GitPlugin: ported code from TracMercurial in trac:changeset:6461
[7756] by hvr on 2010-03-07 17:13:38
minor logging tweak
[7755] by hvr on 2010-03-07 14:00:01
GitPlugin: decode git paths to unicode strings; fixes #5357


Author: Herbert Valerio Riedel
Contributors: Hans Petter Jansson

Attachments (7)

Download all attachments as: .zip