Local Git repository shows "404 The entry or revision was not found in the repository" error

Added by Xander Robar about 9 years ago

Hi all,

I see many of these errors posted, but nearly all of them seem to be related to two things (making sure the redmine user can find/run the git binary, and making sure the redmine user has full permissions on the repository location). I believe that I have eliminated both of these, so I'm hoping someone might have any other suggestions as to where I can look.

My environment is Debian Squeeze, running Webrick for the HTTP server.

Environment:
  Redmine version                          2.1.2.stable
  Ruby version                             1.8.7 (i486-linux)
  Rails version                            3.2.8
  Environment                              production
  Database adapter                         MySQL
Redmine plugins:
  no plugin installed

The issue is that when I click the "Repository" tab for my project, I see the error, "404 The entry or revision was not found in the repository". The repository is a Git repository. The repo is local, and is bare.

I have tried the following:
  • Ensured that the user account redmine is running as can execute "git", and that "git" is in the path for that account.
  • Ensured that the user account redmine is running as has full permissions on the Git repo location.
  • Chmodded the Git repo location to 777, just to try.
  • Deleted and re-created the Git repo.
  • Committed a few files to the repo, just in case it didn't really want a bare repo.

I set the log level to Debug, and while the logs show everything that's going on, they don't tell me why the Git calls are failing. Here is what log/production.log shows when I try to access the repository tab:

Started GET "/projects/test/repository" for 192.168.100.62 at Wed Nov 07 11:02:23 -0500 2012
Processing by RepositoriesController#show as HTML
  Parameters: {"id"=>"test"}
   (0.1ms)  SELECT MAX(`settings`.`updated_on`) AS max_id FROM `settings` 
  User Load (0.2ms)  SELECT `users`.* FROM `users` WHERE `users`.`type` IN ('User', 'AnonymousUser') AND `users`.`id` = ? AND (users.status = 1) LIMIT 1  [["id", 1]]
  Current user: admin (id=1)
  Project Load (0.1ms)  SELECT `projects`.* FROM `projects` WHERE `projects`.`identifier` = 'test' LIMIT 1
  Repository Load (0.1ms)  SELECT `repositories`.* FROM `repositories` WHERE `repositories`.`project_id` = 1 AND (is_default = 1) LIMIT 1
Shelling out: 'git' '--git-dir' '/git-repositories/test.git' '-c' 'core.quotepath=false' '-c' 'log.decorate=no' 'branch' '--no-color' '--verbose' '--no-abbrev'
  EnabledModule Load (0.1ms)  SELECT name FROM `enabled_modules` WHERE `enabled_modules`.`project_id` = 1
Shelling out: 'git' '--git-dir' '/git-repositories/test.git' '-c' 'core.quotepath=false' '-c' 'log.decorate=no' 'ls-tree' '-l' ':'
  Rendered common/error.html.erb within layouts/base (0.1ms)
  UserPreference Load (0.1ms)  SELECT `user_preferences`.* FROM `user_preferences` WHERE `user_preferences`.`user_id` = 1 LIMIT 1
  SQL (0.5ms)  SELECT `members`.`id` AS t0_r0, `members`.`user_id` AS t0_r1, `members`.`project_id` AS t0_r2, `members`.`created_on` AS t0_r3, `members`.`mail_notification` AS t0_r4, `projects`.`id` AS t1_r0, `projects`.`name` AS t1_r1, `projects`.`description` AS t1_r2, `projects`.`homepage` AS t1_r3, `projects`.`is_public` AS t1_r4, `projects`.`parent_id` AS t1_r5, `projects`.`created_on` AS t1_r6, `projects`.`updated_on` AS t1_r7, `projects`.`identifier` AS t1_r8, `projects`.`status` AS t1_r9, `projects`.`lft` AS t1_r10, `projects`.`rgt` AS t1_r11, `roles`.`id` AS t2_r0, `roles`.`name` AS t2_r1, `roles`.`position` AS t2_r2, `roles`.`assignable` AS t2_r3, `roles`.`builtin` AS t2_r4, `roles`.`permissions` AS t2_r5, `roles`.`issues_visibility` AS t2_r6 FROM `members` LEFT OUTER JOIN `projects` ON `projects`.`id` = `members`.`project_id` LEFT OUTER JOIN `member_roles` ON `member_roles`.`member_id` = `members`.`id` LEFT OUTER JOIN `roles` ON `roles`.`id` = `member_roles`.`role_id` WHERE `members`.`user_id` = 1 AND (projects.status<>9) ORDER BY projects.name
   (0.1ms)  SELECT COUNT(DISTINCT `versions`.`id`) FROM `versions` LEFT OUTER JOIN `projects` ON `projects`.`id` = `versions`.`project_id` WHERE (projects.id = 1 OR (projects.status <> 9 AND ( versions.sharing = 'system' OR (projects.lft >= 1 AND projects.rgt <= 2 AND versions.sharing = 'tree') OR (projects.lft < 1 AND projects.rgt > 2 AND versions.sharing IN ('hierarchy', 'descendants')) OR (projects.lft > 1 AND projects.rgt < 2 AND versions.sharing = 'hierarchy'))))
  Wiki Load (0.1ms)  SELECT `wikis`.* FROM `wikis` WHERE `wikis`.`project_id` = 1 LIMIT 1
   (0.1ms)  SELECT COUNT(*) FROM `boards` WHERE `boards`.`project_id` = 1
Completed 404 Not Found in 31ms (Views: 19.0ms | ActiveRecord: 1.3ms)

I'm out of ideas at this point. Might someone have an idea of where I can look to discover the problem?

Thanks!

Replies (9)

RE: Local Git repository shows "404 The entry or revision was not found in the repository" error - Added by Cyril Andreatta almost 9 years ago

Hi there,

I am at exactly the same point as you have been (still are?).
Did you or anybody else find a solution or at least have some tips what to check next.

Best regards,
Cyril

RE: Local Git repository shows "404 The entry or revision was not found in the repository" error - Added by Ivan Cenov almost 9 years ago

I found similar behaviour at http://www.redmine.org .
http://www.redmine.org/projects/redmine/repository/changes/sandbox/ajax_upload When seeing diffs after r10442 diffs may be seen. When seeing diffs before r10442 Redmine says

404

The entry or revision was not found in the repository.
AFAIK, the SCM is Subversion there.

Example:
http://www.redmine.org/projects/redmine/repository/diff/sandbox/ajax_upload?utf8=%E2%9C%93&rev=10442&rev_to=10441

RE: Local Git repository shows "404 The entry or revision was not found in the repository" error - Added by Xander Robar almost 9 years ago

Unfortunately I never did figure this out. I ended up going back to (ugh) Trac, since I just didn't have time to figure it out. Sorry!

RE: Local Git repository shows "404 The entry or revision was not found in the repository" error - Added by Etienne Massip almost 9 years ago

Ivan Cenov wrote:

I found similar behaviour at http://www.redmine.org .
http://www.redmine.org/projects/redmine/repository/changes/sandbox/ajax_upload When seeing diffs after r10442 diffs may be seen. When seeing diffs before r10442 Redmine says
[...]AFAIK, the SCM is Subversion there.

That's because this SVN directory has been created with r10443, isn't it?

RE: Local Git repository shows "404 The entry or revision was not found in the repository" error - Added by Ivan Cenov almost 9 years ago

Etienne Massip wrote:

Ivan Cenov wrote:

I found similar behaviour at http://www.redmine.org .
http://www.redmine.org/projects/redmine/repository/changes/sandbox/ajax_upload When seeing diffs after r10442 diffs may be seen. When seeing diffs before r10442 Redmine says
[...]AFAIK, the SCM is Subversion there.

That's because this SVN directory has been created with r10443, isn't it?

Exactly.

RE: Local Git repository shows "404 The entry or revision was not found in the repository" error - Added by Lukas Steinert almost 9 years ago

I just happend to experience the same issue here at a fresh install (apache+passenger+fcgi+git on sles).

I had to setup the "scm_git_command:" in the configuration.yml in order for redmine to find the binary.

When I used "/usr/bin/git" (note: with the "" in the configuration.yml), redmine was able to determine the version number of git in the settings, and everything seems to work just fine. Well, exept the 404 issue within the repository-tab.

When I used /usr/bin/git (note: without the "" in the config), everything worked right away.

Maybe this is just too trival, but I'm a beginner...so maybe this helps ;)

RE: Local Git repository shows "404 The entry or revision was not found in the repository" error - Added by Cyril Andreatta almost 9 years ago

Well, now it works for me.

My git-repo was not 'bare'.

After cloning a new repo with:
git clone --bare git://yourgitserver.org/project.git

and adding the full! path to the repo in Projects > Settings > Repositories
e.g. /var/repositories/project.git

it finally looks like it should.

Permissions on repo-folder are 775 redmine:redmine

RE: Local Git repository shows "404 The entry or revision was not found in the repository" error - Added by Timon Eckert over 5 years ago

I guess the apache user needs the permission to read the git repository directory (if it is not a bare repo).

Second - which worked for me - you need to direct the path directly into the .git directory e.g /my-project-path/my-project/.git

RE: Local Git repository shows "404 The entry or revision was not found in the repository" error - Added by Lana Rayskaya almost 2 years ago

What worked for me was adding to the users in Redmine a user with credentials from git repository, i.e. the ones that belong to the GitHub account. Nothing else worked before - neither permissions reassignment, nor config editing or path rewriting.

(1-9/9)