HowTo setup automatic refresh of repositories in Redmine on commit » History » Version 1

Version 1/29 - Next » - Current version
Etienne Massip, 2010-06-24 10:37

HowTo setup automatic refresh of repositories in Redmine on commit

Since Redmine 0.9.0, you can use an HTTP submission, either GET or POST, to automatically refresh Redmine after you committed your modification in your repository.


  • /sys/fetch_changesets?key=<your service key> fetches changesets for all active projects
  • /sys/fetch_changesets?id=foo&key=<your service key> fetches changesets for project foo only

See #2925 for original feature request.

Step 1 : configure Redmine to accept the request

Web service for repositories must by activated in the Administration menu and the generated key will have to be used by the caller in Step 2.

Step 2 : setup a post-commit script on the SCM server

You have to setup a post-commit script which will call the previous URL.


Simply add a post-commit (or post-commit.cmd on a Windows system) script file in the hooks sub-directory which contains the HTTP request call :


curl http://<redmine url>/sys/fetch_changesets?key=<your service key>

Or, on a Windows system (2 files) :

  • post-commit.cmd :
    set REPOS="%1" 
    set REV="%2" 
    cscript "%~dp0refresh_redmine.vbs" //Nologo //T:60 /repo:%REPOS% >> "%~dp0refresh_redmine.log" 2>&1
  • refresh_redmine.vbs :
    private const REDMINE_SERVICE_KEY = "<your service key>" 
    Call HTTPPost("http://<redmine url>/sys/fetch_changesets", "key=" & REDMINE_SERVICE_KEY)
    Private Function HTTPPost(sUrl, sRequest)
      set oHTTP = CreateObject("Microsoft.XMLHTTP") "POST", sUrl,false
      oHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" 
      oHTTP.setRequestHeader "Content-Length", Len(sRequest)
      oHTTP.send sRequest
      HTTPPost = oHTTP.responseText
    End Function