How to create Redmine Git repository and avoid - "404 The entry or revision was not found in the repository."

Added by Krunoslav Hrnjak almost 4 years ago

How to create Git repository and avoid - "404 The entry or revision was not found in the repository."

Enviroment setup overview

From Redmine information tab:

Environment:
  Redmine version                2.3.2.stable
  Ruby version                   1.8.7-p352 (2011-06-30) [x86_64-linux]
  Rails version                  3.2.13
  Environment                    production
  Database adapter               Mysql2
Redmine plugins:
  no plugin installed

From shell:
git --version

git version 1.7.1
httpd -v
Server version: Apache/2.2.15 (Unix)
Server built:   Aug 13 2013 10:51:17
apachectl -t -D DUMP_MODULES | grep passenger
passenger_module (shared)

Action taken

1st STEP: Git enabled in redmine settings:

cat $(locate production.log)
Started POST "/settings/edit?tab=repositories" for 10.30.10.129 at Fri Jan 24 13:45:56 +0100 2014
Processing by SettingsController#edit as HTML
  Parameters: {"settings"=>{"repository_log_display_limit"=>"100", "commit_logtime_enabled"=>"0", "sys_api_enabled"=>"0", "commit_fix_done_ratio"=>"100", "commit_ref_keywords"=>"refs,references,IssueID", "autofetch_changesets"=>"1", "commit_cross_project_ref"=>"0", "enabled_scm"=>["", "Git", "Filesystem"], "commit_fix_keywords"=>"fixes,closes", "commit_fix_status_id"=>"0"}, "tab"=>"repositories", "commit"=>"Save", "utf8"=>"✓", "authenticity_token"=>"MvVS4Ri0gTxkckIfbXHZy0Gd/Cw0Z3gqye/hsEn1aNE="}
  Current user: admin (id=1)
Redirected to http://10.31.3.55/settings?tab=repositories
Completed 302 Found in 78ms (ActiveRecord: 13.0ms)
Started GET "/settings?tab=repositories" for 10.30.10.129 at Fri Jan 24 13:45:57 +0100 2014
Processing by SettingsController#index as HTML
  Parameters: {"tab"=>"repositories"}
Settings cache cleared.
  Current user: admin (id=1)
  Rendered settings/_general.html.erb (176.1ms)
  Rendered settings/_display.html.erb (21.1ms)
  Rendered settings/_authentication.html.erb (20.0ms)
  Rendered settings/_projects.html.erb (15.2ms)
  Rendered queries/_columns.html.erb (6.4ms)
  Rendered settings/_issues.html.erb (109.7ms)
  Rendered settings/_notifications.html.erb (0.2ms)
  Rendered settings/_mail_handler.html.erb (6.2ms)
  Rendered settings/_repositories.html.erb (26.2ms)
  Rendered common/_tabs.html.erb (384.5ms)
  Rendered settings/edit.html.erb within layouts/admin (385.4ms)
  Rendered admin/_menu.html.erb (5.7ms)
  Rendered layouts/base.html.erb (96.6ms)
Completed 200 OK in 498ms (Views: 466.7ms | ActiveRecord: 23.8ms)

2nd STEP: Created git repository direcotry and given user rights

Check for redmine user by looking for running process

ps auxf | grep -A 8 -e "apache2 -k star[t]" -e redmin[e]

apache    7296  0.5  6.3 289384 131500 ?       Sl   12:42   0:28 Passenger RackApp: /var/www/html/redmine 

Check for redmine user by looking for log file

ls -l $(locate production.log)

-rw-r--r-- 1 apache apache 1417 Jan 24 13:56 /var/www/html/redmine/log/production.log
mkdir -p /git/test.git
chown apache:apache /git/test.git
ls -ald  /git/test.git
drwxr-xr-x 2 apache apache 4096 Jan 24 13:47 /git/test.git

At this point, I am not sure do I have also create local repository folder (does Redmine latter create repository?) or to create repository.

3rd STEP: Create repository using Redmine

after pressing create:

cat $(locate production.log)
Started POST "/projects/hops-pis/repositories" for 10.30.10.129 at Fri Jan 24 13:49:31 +0100 2014
Processing by RepositoriesController#create as HTML
  Parameters: {"commit"=>"Create", "repository"=>{"extra_report_last_commit"=>"0", "url"=>"/git/test.git", "identifier"=>"test", "is_default"=>"1", "path_encoding"=>""}, "utf8"=>"✓", "repository_scm"=>"Git", "project_id"=>"hops-pis", "authenticity_token"=>"MvVS4Ri0gTxkckIfbXHZy0Gd/Cw0Z3gqye/hsEn1aNE="}
  Current user: admin (id=1)
Redirected to http://10.31.3.55/projects/hops-pis/settings/repositories
Completed 302 Found in 159ms (ActiveRecord: 4.2ms)
Started GET "/projects/hops-pis/settings/repositories" for 10.30.10.129 at Fri Jan 24 13:49:31 +0100 2014
Processing by ProjectsController#settings as HTML
  Parameters: {"tab"=>"repositories", "id"=>"hops-pis"}
  Current user: admin (id=1)
  Rendered projects/_form.html.erb (18.9ms)
  Rendered projects/_edit.html.erb (20.8ms)
  Rendered projects/settings/_modules.html.erb (4.6ms)
  Rendered projects/settings/_members.html.erb (13.9ms)
  Rendered projects/settings/_versions.html.erb (5.2ms)
  Rendered projects/settings/_issue_categories.html.erb (86.1ms)
  Rendered projects/settings/_wiki.html.erb (2.4ms)
  Rendered projects/settings/_repositories.html.erb (6.6ms)
  Rendered projects/settings/_boards.html.erb (2.5ms)
  Rendered projects/settings/_activities.html.erb (13.3ms)
  Rendered common/_tabs.html.erb (163.1ms)
  Rendered projects/settings.html.erb within layouts/base (164.0ms)
Completed 200 OK in 206ms (Views: 180.8ms | ActiveRecord: 11.7ms)

4th STEP: Entering repository

404
The entry or revision was not found in the repository.
cat $(locate production.log)
Started GET "/projects/hops-pis/repository" for 10.30.10.129 at Fri Jan 24 13:50:10 +0100 2014
Processing by RepositoriesController#show as HTML
  Parameters: {"id"=>"hops-pis"}
  Current user: admin (id=1)
  Rendered common/error.html.erb within layouts/base (0.5ms)
Completed 404 Not Found in 248ms (Views: 58.5ms | ActiveRecord: 7.2ms)

Please help. Thanx.

I alredy read http://www.redmine.org/projects/redmine/wiki/RedmineRepositories and various posts on this topic, stil without any sucess in resolving problem.

Problem resolved, I havent created and pushed anything to my repository.

mkdir -p /var/test.git
chown apache:apache /var/test.git/
cd /var/test.git/
git init --bare

cd ..
mkdir -p /var/test.local.git
cd /var/test.local.git/
git init
touch TEST.txt
git add TEST.txt
git commit -m "repository initalization" 
git push /var//test.git/ master

1.JPG (31.4 KB)

3.JPG (21.5 KB)

2.JPG (39.9 KB)

4.JPG (17 KB)

Replies (4)

redmine with a specific gitolite user - Added by Pierre de LESPINAY about 3 years ago

I have this 404 error when trying to display certain repos but not with the same reason.
My Redmine seems to use git as user to read the repos but the repos are not owned by git in my installation.
So my workaround is to allow access to git for each new repos:

$ sudo setfacl -R -m u:git:rX /home/my_gitolite_user/repositories/

Is there a way to tell redmine to use a different user to read the repos ?

RE: How to create Redmine Git repository and avoid - "404 The entry or revision was not found in the repository." - Added by Phil C about 3 years ago

I have 2.5.1, but had the same issue and it turned out the path I was using was wrong. Originally I thought the path was...

/git/test.git

You need to put the full path to the .git directory, not the normal repo you would work under. This changes the path to this...

/git/test.git/.git

You can check that Redmine can see the path by changing to location of the .git directory and running git --git-dir '.' log to see what git thinks of the path. If you update the repository index manually /path_to_redmine/redmine/script/rails runner "Repository.fetch_changesets" -e production you can see what redmine is seeing in the output.

RE: redmine with a specific gitolite user - Added by Hongjoo Lee about 3 years ago

I got exactly the same error as described as Krunoslav Hrnjak but the reason cannot be the empty repository in my case.

Also in my case, "git" is owned by "root" and probably run with runners' privilege who ever it is when it runs.

Then actually the privilege is the same as redmine runner in my situation, which means the same error still can happen not only because of access permission of git repository but also because of some other possible causes.

Pierre de LESPINAY wrote:

I have this 404 error when trying to display certain repos but not with the same reason.
My Redmine seems to use git as user to read the repos but the repos are not owned by git in my installation.
So my workaround is to allow access to git for each new repos:
[...]

Is there a way to tell redmine to use a different user to read the repos ?

(1-4/4)