Search code examples
gittrac

Automatically adding new Git branches to Trac


How can I tell Trac about newly-added Git branches? Since talk about Git can get confusing quickly, here's a concrete example: Suppose I have a "central" Git server, foo.example.com, which my Trac installation exports, and on some host I:

$ git clone [email protected]:/path/to/repo.git
$ cd repo
$ git checkout -b test_branch
$ git push -u origin test_branch

I now have a new branch on the central server called "test_branch", yet this is not accessible from Trac. How can I 1) make it accessible (e.g. under the "Visit" drop-down box) and 2) make this happen automatically for any new branch?

Update: Maybe I should mention that the repository exported by Trac is not "the" central repo. It's owned by another user and currently the webserver user doesn't have access. Instead there's a separate repo owned by and exported by the web server user. Both the central repo and the web server happen to be on the same machine, though.

STNBU


Solution

  • Read about Trac repository administration in the authoritative wiki documentation.

    There is certainly no such thing like auto-discovery for repositories in a give path. You could use trac-admin calls from a terminal to add new repositories, if you dislike doing it via admin web-UI. And make sure to get repository synchronization right for every repository as well.

    If this is a repeating task, you may want to write a simple Python script to do it all more efficiently.