Project

General

Profile

Redmine Git authentication

Added by Joost Buijgers over 12 years ago

Hi everyone,

I'm trying to integrate Git into Redmine (1.4.0), but every time I try to clone a repository from my Git server it says 'fatal: Authentication failed'. The command I am using is 'git clone http://user:pass@git.domain.ext/project.git'. Where 'user:pass' equals a user in the Redmine system/database.

I updated my /usr/share/redmine/extra/svn/Redmine.pm according to Issue #4905 to get the RedmineGitSmartHttp trigger to work. Redmine.pm is linked (ln -s) at /usr/lib/perl5/Apache/Redmine.pm

Is there any way I can debug this process, like beeing able to see what kind of data is send to Redmine.pm. I'm suspecting Redmine.pm isn't comparing the login data the right way.

Versions

Debian 6.0 (Squeeze)
Apache 2.2.16
MySQL 5.1.61
Phusion Passenger 3.0.12
Redmine 1.4.0

Script/about output

Ruby version 1.8.7 (x86_64-linux)
RubyGems version 1.8.22
Rack version 1.1.3
Rails version 2.3.14
Active Record version 2.3.14
Active Resource version 2.3.14
Action Mailer version 2.3.14
Active Support version 2.3.14
Application root /usr/share/redmine
Environment production
Database adapter mysql
Database schema version 20120301153455

Apache config

<VirtualHost *:80>
  ServerName git.domain.ext
  ServerAdmin webmaster@domain.ext
  DocumentRoot "/var/git" 

  ErrorLog /var/log/apache2/git-error.log
  CustomLog /var/log/apache2/git-access.log combined

  PerlLoadModule Apache::Redmine

  SetEnv GIT_PROJECT_ROOT /var/git/
  SetEnv GIT_HTTP_EXPORT_ALL

  <Directory "/var/git">
    Options None
    AllowOverride None
    Order allow,deny
    Allow from all
  </Directory>

  ScriptAlias / /usr/lib/git-core/git-http-backend/
  <Location "/">
    AuthType Basic
    AuthName "GM Git Repositories
    Require valid-user

    PerlAccessHandler Apache::Authn::Redmine::access_handler
    PerlAuthenHandler Apache::Authn::Redmine::authen_handler

    RedmineDSN "DBI:mysql:database=redmine;host=localhost" 
    RedmineDbUser "redmine" 
    RedmineDbPass "password" 
    RedmineGitSmartHttp yes
  </Location>
</VirtualHost>

Passenger config

PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.12
PassengerRuby /usr/bin/ruby1.8
PassengerDefaultUser www-data


Replies (2)

Redmine Git authentication [Solved] - Added by Joost Buijgers over 12 years ago

Solved it!

I enabled MySQL logging to see the exact query it was executing, I noticed that it was using the wrong project identifier. In the URL 'http://user:pass@git.domain.ext/project.git' the .git file is used a the project identifier, therefore these must have the same name or it will just return an empty result set.

Hope this helps anyone!

    (1-2/2)