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 user.name="your_username" # git config user.email="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))$" \
/usr/lib/git-core/git-http-backend/$1
SetEnv GIT_PROJECT_ROOT /var/git
SetEnv GIT_HTTP_EXPORT_ALL
<Location /git>
AuthType Basic
AuthName "Redmine git repositories"
Order deny,allow
Deny from all
#Allow from server_IP
Allow from 127.0.0.1
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
</Location>
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!