Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've setup redmine and have working mercurial repositories.

The hg repos are located in /home/hg/repos so I've set hg as owner to be able to push.

Is it possible to make redmine automatically setup repos when "creating" them in the web UI? There's only one person I can trust with su access on our linux machine but several users should be able to create projects and associated repos. It would be ideal to set this up so redmine automatically creates those repos.

Is this possible? Am I clear enough in my question?

share|improve this question
up vote 1 down vote accepted

Yes. The reposman.rb script is explicitly meant for this purpose.

Usually it is done calling the above script on a cronjob i.e:

10 * * * * root ruby /root/redmine-1.0.0/extra/svn/reposman.rb --redmine-host http://my.redmine./ --svn-dir /data/svn/ --url my.svn.server --key=mykey --owner apache --verbose >> /var/log/reposman.log 

However, mercurial does not have an equivelent implementation as the above is for SVN ( It is possible to write your own hooks to accomplish this. If you don't mind modifying the Redmine core you can use the information here as very minimal source of approach on the issue:

With above method you could call a shell script containing the commands you would normally use to create a repository. This is fully customizable. (A shell script is just a file with execute permissions containing commands as you would type them on the command line). Basically using that guide for creating a repository you would call a script which created a directory by the name of the project identifier cd into that directory and then run hg init You could then use mysql to add the repository automatically to the project identified by the project identifier.

A more elegant solution would be to use the above with native Redmine hooks in a plugin or creating copies of the modified pages in a plugin which would automatically override the Redmine core -

If you need to do anything with the database the below is helpful:

share|improve this answer

Check out the Repositories page on the Redmine Wiki and scroll down to the Mercurial repositories section to make sure that your setup correctly.

You can then check out the Apache Configuration for Mercurial Repositories on the Redmine Wiki to make sure you have the right setup to gain access control from within Redmine.

Apache configuration for Mercurial repositories

Create a file caled "hgweb.config" in the same folder as "hgwebdir.cgi". This foder will be the root repository folder. Then edit the "hgweb.config" with something like this:


allow_push = *
allowbz2 = yes
allowgz = yes
allowzip = yes

Follows the instructions to install as described and configure your apache like this.

RewriteEngine on
PerlLoadModule Apache2::Redmine
PerlLoadModule Authen::Simple::LDAP
ScriptAliasMatch ^/hg(.*)  /path/to/the/hgwebdir.cgi/$1
<Location /hg>
    AuthType Basic
    AuthName "Mercurial" 
    Require valid-user

    #Redmine auth
    PerlAccessHandler Apache::Authn::Redmine::access_handler
    PerlAuthenHandler Apache::Authn::Redmine::authen_handler
    RedmineDSN "DBI:mysql:database=redmine;host=localhost" 
    RedmineDbUser "DB_USER" 
    RedmineDbPass "DB_PASSWD" 
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.