Modify

Opened 3 years ago

Last modified 2 years ago

#8844 reopened defect

«No changeset HEAD in the repository»

Reported by: peet Owned by: hvr
Priority: normal Component: GitPlugin
Severity: blocker Keywords:
Cc: Trac Release: 0.12

Description

With

cached_repository = false
persistent_cache = false

I've got «No changeset HEAD in the repository»

With

cached_repository = true
persistent_cache = true

I've got «Invalid changeset number (No changeset 4553bfa7e59390cf8d0452119a22de5a7a7ef0ac in the repository)»

  • Trac version: 0.12.1
  • GitPlugin version: 2c2193164c4a79ff7c44cff47ffa3575a7bfd4b1 from git repo

How to check/reproduce:

This completely blocks GitPlugin usage on my repo :(

Any logs/traces I can attach on a request.

Attachments (0)

Change History (8)

comment:1 Changed 3 years ago by peet

  • Resolution set to invalid
  • Status changed from new to closed

Sorry, it was my mistake — non-trivial misconfiguration in file access rights

comment:2 Changed 3 years ago by anonymous

  • Resolution invalid deleted
  • Status changed from closed to reopened

Could you please explain your solution?

I have the same problem here, a true blocker, and I have no idea how to solve it.

comment:3 Changed 3 years ago by anonymous

It was really my fail. I have the installation:

  • gitolite (user:group gitolite:gitolite) with home /var/lib/gitolite
  • git daemon (running from xinetd under user gitolite)
  • trac instance (running standalone under euid:egid trac:tracadmin

So the main issue was to allow the trac instance to access to the gitolite repos. Firstly I just made chgrp -R tracadmin /var/lib/gitolite/repositories, and trac worked... just up to the first git push. After it, there was new git objects in the repository, again with gitolite:gitolite instead of gitolite:tracadmin.

I forgot the setgid bit on the repo directory. Now it is turned on, and all new files and directories are properly owned.

...

So, just make sure that trac instance can access every file in the git repository.

comment:4 follow-ups: Changed 3 years ago by sfohart@…

I've got this message:

Invalid Changeset Number
No changeset e38aaa447ca1d84f9043f4b1606f536c64b2de1e in the repository.

The sha1 code have 41 characters,

# echo e38aaa447ca1d84f9043f4b1606f536c64b2de1e | wc -m

and this plugin only support 40 characters. What I do now?

comment:5 in reply to: ↑ 4 Changed 3 years ago by anonymous

Well, if I set

[git]
## let Trac cache meta-data via CachedRepository wrapper
cached_repository = true
## disable automatic garbage collection for in-memory commit-tree cache
persistent_cache = true

This error occurr and I don't see the repository changesets on ticket, but if I set

[git]
## let Trac cache meta-data via CachedRepository wrapper
cached_repository = false
## disable automatic garbage collection for in-memory commit-tree cache
persistent_cache = false

I don't see both commit's effects on browse source and the repository changesets on tickets.

Replying to sfohart@gmail.com:

I've got this message:

Invalid Changeset Number
No changeset e38aaa447ca1d84f9043f4b1606f536c64b2de1e in the repository.

The sha1 code have 41 characters,

# echo e38aaa447ca1d84f9043f4b1606f536c64b2de1e | wc -m

and this plugin only support 40 characters. What I do now?

comment:6 in reply to: ↑ 4 ; follow-up: Changed 3 years ago by sfohart@…

I set the setgid bit on all files into repository

# chmod -R g+s /path/to/repository/git
# find /path/to/repository/git -type d -print0 | xargs -0 chmod g+s

And the problem continue occurring

Replying to sfohart@gmail.com:

I've got this message:

Invalid Changeset Number
No changeset e38aaa447ca1d84f9043f4b1606f536c64b2de1e in the repository.

The sha1 code have 41 characters,

# echo e38aaa447ca1d84f9043f4b1606f536c64b2de1e | wc -m

and this plugin only support 40 characters. What I do now?

comment:7 in reply to: ↑ 6 Changed 3 years ago by Belac

Replying to sfohart@gmail.com:

I set the setgid bit on all files into repository

# chmod -R g+s /path/to/repository/git
# find /path/to/repository/git -type d -print0 | xargs -0 chmod g+s

And the problem continue occurring

Replying to sfohart@gmail.com:

I've got this message:

Invalid Changeset Number
No changeset e38aaa447ca1d84f9043f4b1606f536c64b2de1e in the repository.

The sha1 code have 41 characters,

# echo e38aaa447ca1d84f9043f4b1606f536c64b2de1e | wc -m

and this plugin only support 40 characters. What I do now?

I ended up doing a really hacky post-receive hook that did chown and chmod to the repos directory:

#!/bin/sh
chown -R git:www-data /home/git/repositories/repo.git
chmod -R ug+rwx /home/git/repositories/repo.git

I'm sure there's a better way to do this, but I got tired of fighting it.

comment:8 Changed 2 years ago by felixhummel

Here's my setup. Hope it helps someone:

  • gitolite (user:group git:git) with home /home/git
  • trac (user:group trac:trac)

Add trac to group git

adduser trac git

Set umask for new repositories, resulting in rw-r----- (640) for files and (750) rwxr-x--- for directories.

perl -i.bak -pe 's/(UMASK\s+=>\s+)\d{4}/${1}0027/' /home/git/.gitolite.rc

Fix old repos:

find /home/git/repositories -type d -exec chmod 750 {} \;
find /home/git/repositories -type f -exec chmod 640 {} \;

Add Comment

Modify Ticket

Action
as reopened The owner will remain hvr.
Author


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

 
Note: See TracTickets for help on using tickets.