Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trac 1.0 unable to browse source for Git repository

Tags:

git

trac

I am having a slew of problems concerning git with the new Trac 1.0. I have updated Trac from 0.12 to 1.0. The new version of Trac now comes with native git support, but I do not see the Browse Source tab present. The git repository and trac installation reside on the same server. I have followed this: TracGit.

As the guide had suggested, I have added these lines to my trac.ini file:

[trac]
...
repository_type = git
repository_dir = /home/gituser/repositories/myproject.git
repository_sync_per_request = 

...

[git]
cached_repository = false
git_bin = /usr/bin/git
git_fs_encoding = utf-8
persistent_cache = false
# projects_base = <inherited>
# projects_list = <inherited>
# projects_url = <inherited>
shortrev_len = 7
trac_user_rlookup = false
use_committer_id = true
use_committer_time = true
wikishortrev_len = 40

[components]
tracopt.versioncontrol.git.* = enabled

Now if I go to the Administration page-> Repositories, I see the Manage Repositories screen. From here, I see that I have a link listed with the directory path of /home/gituser/repositories/myproject.git. The Name and Type are both set to default for some reason (I don't see how I can change this in trac.ini). If I click on the link, I get to view the repository in more detail. However, it is read-only and I see this note:

Note: This repository is defined in trac.ini and cannot be edited on this page.

If I try to create a new repository using the Administration webpage using the same directory, I get an error saying that I need to use the full path.

If I try to access the trac repository browser by manually typing in "http://myproject/browser", I get this odd error:

/home/gituser/repositories/myproject.git does not appear to be a Git repository

The thing is, that git repository definitely exists. I can see all the files associated with that repository, such as the branches and hooks folder. And I can push and pull through the terminal just fine.

There is no files located in the myproject trac log folder, so I can't even check the logs for what is wrong.

So it seems like there are two problems:

  • Why does the Browse Source tab not show at all (Or does it not show because of the second problem)?

  • Why does Trac think that the git project doesn't exist when it does?

Any help is appreciated!

like image 683
user1802001 Avatar asked Oct 22 '22 03:10

user1802001


1 Answers

You're not seeing the "Browse Source" tab because Trac doesn't have a repository for you to browse (as far as it knows). Solving the "does not appear to be a Git repository" problem should make the "Browse" tab appear as expected.

This problem will be significantly easier to solve if you can get Trac's logfile. On Trac's admin page, make sure that Trac is set to log to a file, that the log level is set to "debug", and that the user account used by the web server has write permissions to the log file file/folder.

You mentioned that you are using a Trac installation that was upgraded from 0.12 to 1.0. When you upgraded, did you completely disable and remove the git plugin? If your server is still loading the old plugin, or any of its configuration files, it's not unreasonable to think that this would interfere with Trac's native git support.

I'm assuming that this is the same repository that you were previously using with 0.12? If not, make sure that your web server's user account has access rights to the folder where your git repo is located.

You may also want to try setting up a new Trac environment (with no plugins) and testing whether it can access your repository. This would eliminate any issues that may be caused by the upgrade process. You can always migrate all of your content and data to the new environment if needed.

like image 50
bta Avatar answered Oct 27 '22 09:10

bta