Convert the SVN repository to GitLab

From Apoyar Wiki
Revision as of 16:27, 13 February 2017 by 78.45.88.190 (talk) (Minor cosmetic changes.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Following this guide allows one to convert a specific SVN repository to a GitLab project, including turning SVN revisions to commits and the participants to GitLab users.


  • SSH to phobos.apoyar This server is reserved for maintenance/support and has all relevant software installed.
  • Obtain the SVN url of the repository in question. The one used has already been converted, use it as an example.
  • cd to /home/neal/git/svn This is an empty folder reserved for the conversion process:
    • git svn clone --no-minimize-url http://saturn:8008/svn/Apoyar/BMAPI/BleckmannApi .
  • Examine the results in the folder. Use git status to check.
  • Create new project on GitLab. Copy its url. In this example, the BleckmannAPI project has been used, please use yours.
  • Push to GitLab:
    • git remote add origin https://gitlab.apoyar.eu/root/BleckmannAPI.git
    • git push –u origin master
  • GitLab will now show all commits and files of the repository. Only master branch will exist
  • if there is a non-existing user(s) in commits:
    • Open the project in GitLab
    • Browse through the commits
    • Copy and paste all user emails you found to text file
    • Make the master branch unprotected
    • Copy the git-author-rewrite.sh file (residing in the parent folder: /home/neal/git/) to the current svn folder.
    • Edit the file and replace the following values with their current ones:.
      • OLD_EMAIL=" "
      • CORRECT_NAME=" "
      • CORRECT_EMAIL
    • Run ./git-author-rewrite.sh
    • Push the changes over:
      • git push --force --tags origin 'refs/heads/*'
    • check whether it’s OK
    • delete the backup:
      • git update-ref -d refs/original/refs/heads/master
    • if there are more usernames just repeat the steps from Edit the file and replace the values in question.