Modify

Opened 14 years ago

Closed 9 years ago

#7381 closed defect (wontfix)

GitError: GIT control files not found, maybe wrong directory?

Reported by: dima2 Owned by: Herbert Valerio Riedel
Priority: highest Component: GitPlugin
Severity: blocker Keywords: Git control files
Cc: Trac Release: 0.11

Description

How to Reproduce

While doing a GET operation on /, Trac issued an internal error.

(please provide additional details here)

Request parameters:

{}

User agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.6) Gecko/20100628 Ubuntu/10.04 (lucid) Firefox/3.6.6

System Information

Trac 0.12
Genshi 0.6
GIT 1.5.6.5
mod_python 3.3.1
pysqlite 2.4.1
Python 2.6.2 (r262:71600, Sep 8 2009, 13:06:43)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)]
setuptools 0.6c9
SQLite 3.3.6
jQuery 1.4.2

Enabled Plugins

TracGit 0.12.0.2dev-r7757

Python Traceback

Traceback (most recent call last):
  File "build/bdist.linux-i686/egg/trac/web/main.py", line 513, in _dispatch_request
    dispatcher.dispatch(req)
  File "build/bdist.linux-i686/egg/trac/web/main.py", line 200, in dispatch
    chosen_handler)
  File "build/bdist.linux-i686/egg/trac/web/main.py", line 346, in _pre_process_request
    chosen_handler = filter_.pre_process_request(req, chosen_handler)
  File "build/bdist.linux-i686/egg/trac/versioncontrol/api.py", line 330, in pre_process_request
    repo = self.get_repository(reponame)
  File "build/bdist.linux-i686/egg/trac/versioncontrol/api.py", line 526, in get_repository
    repos = connector.get_repository(rtype, rdir, repoinfo.copy())
  File "build/bdist.linux-i686/egg/tracext/git/git_fs.py", line 186, in get_repository
    shortrev_len=self._shortrev_len)
  File "build/bdist.linux-i686/egg/tracext/git/git_fs.py", line 205, in __init__
    git_bin=git_bin).getInstance()
  File "build/bdist.linux-i686/egg/tracext/git/PyGIT.py", line 120, in __init__
    i = Storage(repo, log, git_bin)
  File "build/bdist.linux-i686/egg/tracext/git/PyGIT.py", line 194, in __init__
    raise GitError("GIT control files not found, maybe wrong directory?")
GitError: GIT control files not found, maybe wrong directory?

Attachments (0)

Change History (18)

comment:1 Changed 14 years ago by anonymous

what happened? help plz...

comment:2 Changed 14 years ago by anonymous

Trac Release: 0.11, same 0.12

comment:3 Changed 14 years ago by Steffen Hoffmann

Component: SELECT A HACKGitPlugin
Keywords: Git control files added
Owner: changed from anonymous to Herbert Valerio Riedel
Trac Release: 0.120.11

What happend? You didn't select the proper component, and since you're not a registered user with this site you're not allowed to change it afterwards.

Anyway you should still provide more details regarding your configuration (trac.ini, etc.) to give us something to help you. And putting in your email address will help you much with tracking the changes of your ticket.

comment:4 Changed 14 years ago by Antti Kaihola

I have the same problem with Trac 0.12.1, GitPlugin 0.12 r7757 and python-subversion 1.6.6dfsg-2ubuntu1. From the log file:

2010-10-14 17:35:46,836 Trac[PyGIT] DEBUG: requested PyGIT.Storage instance 28793744 for '/home/akaihola/test.git'
2010-10-14 17:35:46,836 Trac[git_fs] INFO: enabled CachedRepository for '/home/akaihola/test.git'
2010-10-14 17:35:46,837 Trac[PyGIT] ERROR: GIT control files missing in '/home/akaihola/trac/git'
2010-10-14 17:35:46,837 Trac[chrome] ERROR: Error with navigation contributor BrowserModule: GitError: GIT control files not found, maybe wrong directory?

The directory /home/akaihola/test.git is a bare repository created with git init --bare, and I've pushed several commits into it. All directories and files are owned by me and I run tracd as myself.

Modifications I've made to the default trac.ini:

[trac]
repository_dir = /home/akaihola/test.git
repository_type = git

[git]
cached_repository = true
persistent_cache = true
shortrev_len = 7
git_bin = /usr/bin/git

[components]
tracext.git.* = enabled

I've also tried without the settings in the [git] section. Same error.

comment:5 Changed 14 years ago by Antti Kaihola

This might help: I ran tracd in the Python debugger, and evaluated these at trac/versioncontrol/api.py:526:

ipdb> import pprint;pprint.pprint(self.get_all_repositories())
{'': {'dir': u'/home/akaihola/repos/test.git',
      'id': 2,
      'name': ''},
 u'/home/akaihola/repos/test': {u'dir': u'/home/akaihola/trac/git',
                                'id': 1,
                                u'name': u'/home/akaihola/repos/test',
                                u'type': u''}}
ipdb> self
<trac.versioncontrol.api.RepositoryManager object at 0x26ab150>

comment:6 Changed 14 years ago by Antti Kaihola

Solved: the trac-admin repository add command adds invalid entries into the database. Fixed them directly with sqlite3 and all works correctly.

comment:7 Changed 14 years ago by anonymous

What exactly was your trac-admin repository add command in the first place btw?

comment:8 Changed 14 years ago by Antti Kaihola

I tried to reproduce the problem, without success. I was messing around with both the [trac]/repository_dir and [trac]/repository_type settings and the trac-admin test repository add test /home/akaihola/test.git git or similar commands, and the repository table ended up containing entries with strange paths.

It's confusing that for some reason I ended up having the key repository_dir with a value like git:/home/akaihola/test.git instead of dir and /home/akaihola/test.git in the repository table. It looks like this has something to do with specifying the repository in trac.ini.

Sorry for not being able to reproduce exactly what happened before.

comment:9 Changed 14 years ago by anonymous

thx for trying to reproduce :-)

do you remember if you could have fixed that problem also by using the repository section within the trac admin pages, instead of having to directly fix the sqlite database?

comment:10 Changed 13 years ago by dan@…

I had this same error... looking closely at my trac.ini, I found an error in the path to the Git repo. So, the 'maybe wrong directory' hint was right on! Once fixed & resynced, all was fine!

comment:11 Changed 13 years ago by sai.giridhar@…

I recently had done two installation of the git plugin and i have come across this error on both of them. I have solved it by doing

sudo chown -R git:www-data git-repository

and make sure that the group user has a read access to the repository. Hope this helps :)

comment:12 Changed 13 years ago by anonymous

Thanks for the permissions hint - I've moved my repositories during Lenny to Squeeze upgrade, and lost the group permission, causing this error to appear.

comment:13 in reply to:  11 Changed 13 years ago by anonymous

Replying to sai.giridhar@inso.tuwien.ac.at:

sudo chown -R git:www-data git-repository

In case of usage with gitolite: remember to setup a post receive hook. By default the ownership changes with each commit back to git:git.

comment:14 Changed 13 years ago by anonymous

for me, it's really because I was not using a bare repo/not pointing to .git.

comment:15 Changed 12 years ago by track-hacks@…

One more hint: If you are running trac with apache and mod-python, remember to restart apache after adding the apache user (www-data on debian/ubuntu) to a group with permissions to your git repository. This is not needed if the apache user is the actual owner of the repository, only if it is a group member.

comment:16 Changed 10 years ago by Walkman

I had the same issue. Deleting and readding the repository in Trac admin solved the issue. I did that based on comment:6, thank you!

comment:17 Changed 10 years ago by Ryan J Ollos

At least for the case of non-bare repositories, a similar issue was fixed in trac:#11297. For a non-bare repository, the Repository path must point to a .git directory (at least prior to [trac 12225], which using TracGit that is part of the Trac core). There is also trac:#11371, which might be responsible for some issues.

comment:18 Changed 9 years ago by Ryan J Ollos

Resolution: wontfix
Status: newclosed

GitPlugin is deprecated. Please upgrade to Trac 1.0 and use TracGit.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Herbert Valerio Riedel.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.