how are you using the trac repository? Usually you have trac running on a server where you push to. The post-commit hook does not get run after a push.
You need a post-receive hook in this case.
I made a a few changes to the post-receive hook in the git-plugin package, since it had some bugs. (f.ex. you can only make one change/second to a ticket in trac, so I had to add a sleep(1), since when you push all your commits would get processed in the same seccond. And you can also supply a number of worked hours)
This post-receive hook can be found on my github: https://github.com/JensTimmerman/TRAC-SVN-to-GIT-migration/blob/master/hooks/trac-post-receive-hook.py
you have to install this to /path/to/your/.git/hooks/post-receive
and make sure it's executable (chmod +x /path/to/your/.git/hooks/post-receive in linux) and change the "TRAC_ENV = '/home/jens/tractest/'" to point to your trac environment.
edit:
If you're not hosting your git repository on the same server as you're running trac on you can do a pull to a temporary git repo and push again to the one trac uses with a cron job or so. This will then again trigger the post-receive hook on your real repository and update your trac.
I have this in place:
a64609@chaos:~/git$ ls
gitcron.log realrepo syncgit.sh tmprepo
where tmprepo is just a location where i pull and push to and realrepo has my post-receive hook.
with syncgit.sh:
cd /home/username/git/tmprepo;
git pull;
git push real;
and the remote 'real' of tmprepo set to
a64609@chaos:~/git/tmprepo$ git remote -v show
origin https://JensTimmerman@github.com/hpcugent/easybuild.git
real ../realrepo/
and everything get's synced by a crontab entry (put this in crontab -e)
*/3 * * * * /hhome/username/git/syncgit.sh >> /home/username/git/gitcron.log 2>&1