Skip to content
Easily migrate your Trac instance to Gitlab
Branch: master
Clone or download
micvm and moimael Gitlab 11.8 apiv4 fixes (#34)
* Fix crash on missing/existing wiki folder for export

* Fix crash when trac ticket title is longer than 255 characters

* Merge and adapt useful helper methods from fork to create wiki pages, upload files etc.

* Remove unrecognized fallback parameter when parsing configuration map

* Fix issue with wrong issue/ticket id preventing all changes to be assigned to correct issue in gitlab

* Fix problems for missing for milestones. Set a default one in that case.

* Merge and adapt from handling of ticket changes such as attachments, vendor and others

* Create wiki pages on gitlab via API during migration

* Fix wrong issue id on closing of ticket

* Remove unnecessary addition of private_token

* Fetch more than 20 milestone (as set per default by gitlab api)
Latest commit b0ddf46 Sep 16, 2019


This script migrates milestones, issues and wiki pages from trac to GitLab.

NOTE: This project is in deprecated, in favor of tracboat/tracboat.


  • Component & Issue-Type are converted to labels
  • Comments to issues are copied over
  • Supports two modes of tansfer:
  • Using GitLab web API
  • Direct access through GitLab's database and file system
  • In direct mode, attachments are transfered and the issues and notes dates and ownership are preserved
  • In API mode, attachments are not transfered, issues and notes are owned by a single user and their dates are the current date.


Migrating a trac project to GitLab is a relatively complex process involving four steps:

  • Create a new project
  • Migrate the repository (can just be cloning a git repository if the trac project is already using git or could involve converting from subversion using git-svn)
  • Create the users for the project
  • Migrate issues and milestones
  • Migrate wiki pages

This script takes care of the last two bullet points and provides help for the third one.


  1. copy migrate.cfg.example to migrate.cfg
  2. configure the values
  3. run ./ to extract the user names from Trac
  4. update migrate.cfg and create the users in GitLab
  5. run (./ Make sure you test it on a test project prior, if you run it twice against the same project you will get duplicated issues unless you're using direct access with overwrite set to yes.

Issues and milestones are copied to GitLab.

Wiki pages are copied to a folder on your machine and must be pushed into GitLab using wiki's git access.

GitLab versions

The database model should correspond to the version of GitLab that you are using.

This repo contains models for multiple versions (gitlab_direct/ and the version number should be updated correspondingly in the imports in gitlab_direct/ and gitlab_direct/

To support a new version, use

$ -e postgresql -u gitlab gitlabhq_production > gitlab_direct/model<version>.py

Manual updates must then be applied, see for instance the manual updates for 6.4.


The configuration must be located in a file named "migrate.cfg"


  • url - xmlrpc url to trac, e.g.


  • project_name - the destination project including the paths to it. Basically the rest of the clone url minus the ".git". E.g. jens.neuhalfen/task-ninja.
  • method - direct or api

ÄPI mode:

  • url - e.g.
  • access_token - the access token of the user creating all the issues. Found on the account page, e.g. secretsecretsecret
  • ssl_verify - set to yes to verify SSL server certificates.

Direct mode:

  • ```overwrite````- if set to yes, the milestones and issues are cleared for this projects and issues are recreated with their trac id (useful to preserve trac links)
  • db-name - MySQL database name
  • db-user - MySQL user name
  • db-password - MySQL password
  • uploads - GitLab uploads directory
  • usernames Comma separed list of username mappings such as: trac1->git1, trac2->git2


  • migrate - Should the wiki pages be converted?
  • target-directory - Directory in which the wiki pages should be written


  • migrate - Should we migrate issues and milestones?


LGPL license version 3.0 (see the licences directory).



  • Python 3.2, xmlrpclib, requests
  • Trac with XML-RPC plugin enabled
  • Gitlab

And also, if you use the direct access to GitLab's database:

You can’t perform that action at this time.