after some time I finally made the trac connect with git, but now I'm having problem setting the post-receive hook.

My git user is part of www-data group, and www-data also parta of git group. But the problem is this, the post-receive hook uses this code(python) to do call to trac-admin:

args = [TRAC_ADMIN, TRAC_ENV, 'changeset', 'added', REPO_NAME] + commits
call(' '.join(args), shell = True)

This call the following in a shell:

/usr/bin/trac-admin /var/lib/trac/MyTrac changeset added /home/git/repositories/mynewrepo.git/ 372ba439b9fa430c932095de608cb084d6ab98eb

But when I go to trac and to the ticket that should be referenced by the commit that was done, I get nothing.

But, what is more odd, if I simply copy the call and run it in the terminal(in the server), then the ticket gets updated.

I tested again, this time, I've done a new commit, and again no ticket updated, then in the server done:

su git

And called the command, and saw that no ticket was updated... Then, calling it with root I can make it work...

So, whats going on here? Why can my git user call the trac-admin?

I don't know if this is part of the problem, but when I run which trac-admin, I get:


And this is owned by root.

How am I supposed to make git user call trac-admin then?



So, in the end I couldn't make this work, so I manage to reinstall everything from the beginning.

And when I was installing trac, instead of using apt-get install trac, I downloaded the source from github(trac 0.12) and installed it(with the requeriments also) from there.

After I've done this a checked where was the trac-admin, using "which trac-admin" and it gave me:


And after the install and configuration, everything worked just fine.

So I beleave the apt-get install is not a good way to do things in trac.

Hope this help anyone who might have this problem too.

OBS: I saved the script that install the apache2+trac+git+hooks in github, and if anyone wants to use here is the link: https://github.com/arruda/TRAC-GIT-HOOKS

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.