From SVN to Gitlab on RHEL6


Edit: This howto isn’t finished. I was able to import SVN but didn’t get the repository to appear in Gitlab.

There is a certain SVN project that i’ve moved to gitlab over the weekend. It started with installing the RHEL6 environment, moving all the revisions there with gitlab and then setting up svn-git.



Since it was the first time I was installing gitlab, I looked online for a howto guide. I stumbled upon the automatic script by mattias-ohlsson which didn’t work so well for me. The automated script kept returning error messages regarding an outdated ruby version, which my sudo user indeed was having. I didn’t want to wrap my head around that misery and instead made use of these directions made by Torey Maerz. I didn’t run the script automatically but triggered each command manually. Some notes:

At one point whilst compiling the bundles for gitlabhq, I got into trouble because I had no pg_config, instead installed postgresql-devel.x86_64 and after that the package compiled correctly.

Then passenger came with the directives:

LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p448/gems/passenger-4.0.10/buildout/apache2/
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p448/gems/passenger-4.0.10
PassengerDefaultRuby /usr/local/rvm/wrappers/ruby-1.9.3-p448/ruby

So I put these in my httpd server, together with the directive to turn se_linux off. Yes naughty.
setenforce 0

and then setup my virtual host as follows. Be sure to use a real domainname, as I had trouble getting gitlab to work on an IP.

<VirtualHost *:4000>
  ServerName <domainname.tld>
  # !!! Be sure to point DocumentRoot to 'public'!
  DocumentRoot /var/www/gitlabhq/public
  <Directory /var/www/gitlabhq/public>
     # This relaxes Apache security settings.
     AllowOverride all
     # MultiViews must be turned off.
     Options -MultiViews

Now we adjust the username and password, be sure to do so. That ‘5iveL!fe’ password is floating all over the internet.


Login to the RHEL6 machine and import the svn-git:
install svn-git
yum install ruby rubygems
gem install svn2git

Next is the svn2git import. The followin command was rambling for about 6 hours for a 10 Gb repository. I’d recommend executing the svn2git command with the ‘time’ flag. I also had to ‘nohup’ the command to safely execute on my wifi connection.

time svn2git http://<domain><reponame>  -v --username joop

If you run into an error “the variable $u was not defined“, don’t worry I solved mine with this this fix. It seems like a harmless patch.

Then you can import your project into gitlab using:
1. Copy bare repositories to /home/git/repositories
2. Run bundle exec rake gitlab:import:repos RAILS_ENV=production

One thought on “From SVN to Gitlab on RHEL6

  1. Gauthami


    i am new to Gitlab. And we need to sync our code which is in SVN to Gitlab project.
    I have installed GitLab on Rhel 6.6

    I would like to know how this syc work from svn to git.
    Please suggest me the possible way.

    Guathami. T

Leave a Reply