SVN to GIT Migration Steps in BitBucket

Wednesday, May 11, 2016

SVN to GIT Migration Steps in BitBucket


Below are the Steps for migration from SVN to GIT


One time steps:-

Step 1. Install Git
            >apt-get install git

Step 2. Install GIT-SVN
           >sudo apt-get install git-svn

Step 3. Download svn migration JAR and place in root folder
            https://bitbucket.org/atlassian/svn-migration-scripts/downloads

Step 4. Check If all requirements are OK using verify command
            >java -jar ~/svn-migration-scripts.jar verify

This should give git version, svn version and git-svn version.



Steps to migrate a repository:-

Step 1. Export SVN authors
            java -jar ~/svn-migration-scripts.jar authors svn://192.16.32.10/repoName > authors.txt
or
            java -jar ~/svn-migration-scripts.jar authors svn://localhost/repoName > /usr/temp/repoNameAuthors.txt
This will create authors of SVN which will be mapped to GIT users during migration

Step 2. Change this authors file manually so that user names and email adresses are proper. Save this authors file. This file will be used while SVN to GIT conversion

Step 3. Convert SVN repository to GIT repository
git svn clone --stdlayout --authors-file= svn://
E.g.
git svn clone --stdlayout --authors-file=MyProjectauthors.txt svn://localhost/MyProject /root/GitProjects/MyProject

Step 4. Change directory to GIT repository
E.g. cd /root/GitProjects/MyProject

Step 5. Clean the tags. (To see which tags will be cleaned use below command. Note it will not make any changes)
java -Dfile.encoding=utf-8 -jar ~/svn-migration-scripts.jar clean-git

Step 6. Actually clean the tags.
java -Dfile.encoding=utf-8 -jar ~/svn-migration-scripts.jar clean-git --force

Step 7. Now a git repository is created which is on our local system. we need to import this on bitbucket

Step 8. Go to bitbucket and create a GIT repository

Step 9. On our system on command line change directory to git repository folder

Step 10. Add bitbucket repository as origin repository. From local system where we have converted repository execute this command
git remote add origin https://@bitbucket.org//.git
e.g.
git remote add origin https://gs51@bitbucket.org/gs51/MyProject.git

Step 10. Actually push the contents
              git push -u origin --all

Step 11. Push Tags
              git push --tags

Thanks

0 comments:

About This Blog

Lorem Ipsum

  © Copyright 2009 Linux-HelpLine.Blogspot.com

Back to TOP