Project

General

Profile

Can't connect with git repository: "Not a git repository"

Added by Gustavo Delfino over 13 years ago

Hi. I am moving to a new server. My redmine/git connection was working fine in the old server, but I can't make it work in the new one. My Centos 5.5 server is running apache 2.2.3 with passenger 2.2.15

When I go to the Repository tab in my project, I get this error in the web browser:

"The entry or revision was not found in the repository."

In the log/scm.stderr.log file I get this:

fatal: Not a git repository: '/home/git/repositories/myrepo.git/'
fatal: Not a git repository: '/home/git/repositories/myrepo.git/'
fatal: Not a git repository: '/home/git/repositories/myrepo.git/'

I switched redmine to run in development mode and was able to see in the development.log that the command being run are:

git --git-dir '/home/git/repositories/myrepo.git/' log --no-color --raw --date=iso --pretty=fuller  --all  --since='2010-09-02 14:43:45
git --git-dir '/home/git/repositories/myrepo.git/' ls-tree -l 'HEAD:'

Both commands run fine using the root, git or apache users (tried using sudo -u apache git --git-dir ....)
I added the apache user to the git group and vice-versa. The repository permissions are like this:

[root@admin repositories]# ls -l /home/git/repositories/myrepo.git/
total 32
drwxr-xr-x   2 git apache 4096 Apr 24  2009 branches
-rw-r--r--   1 git apache   67 Apr 24  2009 config
-rw-r--r--   1 git apache   58 Apr 24  2009 description
-rw-r--r--   1 git apache   23 Apr 24  2009 HEAD
drwxr-xr-x   2 git apache 4096 Apr 24  2009 hooks
drwxr-xr-x   2 git apache 4096 Apr 24  2009 info
drwxr-xr-x 260 git apache 4096 May 21  2010 objects
drwxr-xr-x   5 git apache 4096 Apr 24  2009 refs

Additional info about my environment:

[root@admin proyectos]# script/about
./script/../config/../vendor/rails/railties/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010.  Use #requirement
About your application's environment
Ruby version              1.8.7 (x86_64-linux)
RubyGems version          1.3.7
Rack version              1.0
Rails version             2.3.5
Active Record version     2.3.5
Active Resource version   2.3.5
Action Mailer version     2.3.5
Active Support version    2.3.5
Edge Rails revision       unknown
Application root          /home/gds/proyectos
Environment               development
Database adapter          sqlite3
Database schema version   20100819172912
from httpd.conf:
LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.15
PassengerRuby /usr/local/bin/ruby
(...)
User apache
Group apache
(...)
<VirtualHost 63.247.138.159>
  DocumentRoot "/home/gds/proyectos/public" 
  ServerName proyectos.gdsolutions.com.ve
  RailsEnv development
  <Directory "/home/gds/proyectos/public">
    allow from all
    Options +Indexes
  </Directory>
</VirtualHost>

Can anyone help me?


Replies (4)

RE: Can't connect with git repository: "Not a git repository" - Added by Gustavo Delfino over 13 years ago

Forgot this:

# head -n7 doc/CHANGELOG 
== Redmine changelog

Redmine - project management software
Copyright (C) 2006-2010  Jean-Philippe Lang
http://www.redmine.org/

== 2010-10-31 v1.0.3

RE: Can't connect with git repository: "Not a git repository" - Added by Felix Schäfer over 13 years ago

  1. Investigate what user passenger runs as, it's not always the same as the webserver user (look up the passenger docs for more info),
  2. Make sure this user has read permission on the repository and the whole path to there.

RE: Can't connect with git repository: "Not a git repository" - Added by Gustavo Delfino over 13 years ago

You were right.

This is the piece of information that I was not aware of:

"If user switching support is enabled, then Phusion Passenger will by default run the web application as the primary group of the owner of the file config/environment.rb"

http://www.modrails.com/documentation/Users%20guide%20Nginx.html#_passenger_user_lt_username_gt

Thank you Felix.

RE: Can't connect with git repository: "Not a git repository" - Added by Felix Schäfer over 13 years ago

Gustavo Delfino wrote:

This is the piece of information that I was not aware of:

"If user switching support is enabled, then Phusion Passenger will by default run the web application as the primary group of the owner of the file config/environment.rb"

That's the most common pitfall new passenger users run into :-)

Glad you got it working.

    (1-4/4)