Skip to main content

Redmine git integration with Apache

This is a quick post to explain in a few steps the integration of git scm with redmine.

1- Install git package

On Debian:

# apt-get install git 

2- Create base directory for git repositories

# mkdir /var/git
# cd /var/git

3- Create git repository and initialize

# git init --bare myrepo.git
# cd myrepo.git
# git config http.receivepack true
# git config"your_username"
# git config"username@domain"

4- Finally set correct owner for apache

# chown www-data:www-data /var/git/myrepo.git -R

5- Configure Apache for git repositories

In your redmine virtual host add the following:

    ScriptAliasMatch \
          "(?x)^/git/(.*/(HEAD | \
                        info/refs | \
                        objects/(info/[^/]+ | \
                                 [0-9a-f]{2}/[0-9a-f]{38} | \
                                 pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
                        git-(upload|receive)-pack))$" \

        SetEnv GIT_PROJECT_ROOT /var/git
    <Location /git>
      AuthType Basic
      AuthName "Redmine git repositories"
      Order deny,allow
      Deny from all
      #Allow from server_IP
      Allow from
      Require valid-user
      Satisfy any
      ## for mysql
      RedmineDSN "DBI:mysql:database=redmine;host=db_server"
      RedmineDbUser "dbuser"
      RedmineDbPass "dbpass"
      PerlAccessHandler Apache::Authn::Redmine::access_handler
      PerlAuthenHandler Apache::Authn::Redmine::authen_handler

Go to redmine interface and create a git repository in your project specifying the project path as /var/git/myrepo.git and that’s all!

Could not find rake- in any of the sources (Bundler::GemNotFound)

After installing Redmine 2.x I got this error:

*** Exception PhusionPassenger::UnknownError in PhusionPassenger::Rack::ApplicationSpawner (Could not find rake- in any of the sources (Bundler::GemNotFound)) (process 16175):
	from /var/lib/gems/1.8/gems/bundler-1.1.5/lib/bundler/spec_set.rb:90:in `materialize'
	from /var/lib/gems/1.8/gems/bundler-1.1.5/lib/bundler/spec_set.rb:83:in `map!'
	from /var/lib/gems/1.8/gems/bundler-1.1.5/lib/bundler/spec_set.rb:83:in `materialize'
	from /var/lib/gems/1.8/gems/bundler-1.1.5/lib/bundler/definition.rb:127:in `specs'

To solve this I run this command in the redmine application directory

/var/www/redmine/bundle install --path vendor/bundle

bundle:2:in `require’: no such file to load — bundler (LoadError)

I installed Bundler gem during the Redmine installation

# gem install bundler
Successfully installed bundler-1.1.5
1 gem installed
Installing ri documentation for bundler-1.1.5...
Installing RDoc documentation for bundler-1.1.5...

And I got this error:

# bundle
/usr/bin/bundle:2:in `require': no such file to load -- bundler (LoadError)
	from /usr/bin/bundle:2

It seemed that it was not able to load required gem. I found required gem bundler.rb under “/var/lib/gems/1.8/gems/bundler-1.1.5/lib/”

# locate bundler.rb

As a workaround I edited the file /usr/bin/bundle and forced to load the required path:

#!/usr/bin/env ruby
$LOAD_PATH << "/var/lib/gems/1.8/gems/bundler-1.1.5/lib/"
require 'bundler'

And got it working

# bundle
Fetching gem metadata from
Installing rake ( 
Installing i18n (0.6.0) 
Installing multi_json (1.3.6) 

uninitialized constant Rake::DSL

I’ve found this error upgrading to redmine 1.4.4

# rake config/initializers/session_store.rb
(in /var/www/redmine)
rake aborted!
uninitialized constant Rake::DSL
/var/www/redmine/Rakefile:14:in `require'
(See full trace by running task with --trace)

To avoid the error add the following to the top of the RakeFile:

module Rake
  module DSL

Redmine xapian search plugin









Please Consider Supporting this Plugin by Donating:
[wpdonatebuy cid=1]