Subversion (SVN) is a central version control system (VCS) while Git is a distributed version control system.

If you are currently using an SVN repository, you can migrate the repository to Git and GitLab. We recommend a hard cut over – run the migration command once and then have all developers start using the new GitLab repository immediately.

Install svn2git
git clone https://github.com/nirvdrum/svn2git.git
cd svn2git/
yum install git-core git-svn ruby
gem install svn2git
cd bin/
chmod  +x svn2git

Then now lets prepare authors file so svn2git can map authors to Git authors,if we are not choose to create authors file then commits will not be aviable in Gitlab.If auhtors is required to may every author that is present in the SVN repository.
To find the list of authors in svn repository,run the below command.

 

svn log --quiet | grep "^r" | awk '{print $3}' | sort | uniq

From this output,lets prepare authors file.Create file called authors.txt and make sure the format is correct in the file.

arjun = Arjun Kumar <arjunkumar@techrunnr.com>
john = John jose < johnjose@techrunnr.com>

Now,checkout the repository and do the conversion in the current working directory.Make sure to create a new directory for each repository before running the below command.

svn2git https://svn.techrunnr.com/path/to/repo --authors /path/to/authors.txt --rootistrunk

If your SVN repository need username and password to be added,will add the –username <username> and –password <password> flags to the above command.
svn2git supports excluding certain file paths,branches,tags,etc.

Now lets create a new GitLab project and we will push our converted code.Copy the SSH or HTTPS repository URL from the project page.Add the Gitlan repository as Git remote and push all the changes.
This will push all commits,branches and tags.

git remote add origin git@gitlabtechrunnr.com:<group>/<project>.git
git remote -v
git push --all

That’s all, See your GitLab in web view you can see all SVN code in GitLab with commit status and all old history.

© 2019, Techrunnr. All rights reserved.

#1
#2
#3
Questions Answered
Articles Written
Overall Points

0 Comments

Leave a Reply

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.