Convert the SVN repository to GitLab: Difference between revisions
Jump to navigation
Jump to search
(SVN to Git - adding content) |
(Minor cosmetic changes.) |
||
| Line 1: | Line 1: | ||
'''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.''' | |||
| Line 5: | Line 5: | ||
* Obtain the SVN url of the repository in question. The one used has already been converted, use it as an example. | * 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: | * 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 . | ** git svn clone --no-minimize-url <nowiki>http://saturn:8008/svn/Apoyar/BMAPI/BleckmannApi</nowiki> . | ||
* Examine the results in the folder. Use git status to check. | * 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. | * Create new project on GitLab. Copy its url. In this example, the BleckmannAPI project has been used, please use yours. | ||
* Push to GitLab: | * Push to GitLab: | ||
** git remote add origin https://gitlab.apoyar.eu/root/BleckmannAPI.git | ** git remote add origin <nowiki>https://gitlab.apoyar.eu/root/BleckmannAPI.git</nowiki> | ||
** git push –u origin master | ** git push –u origin master | ||
* GitLab will now show all commits and files of the repository. Only master branch will exist | * GitLab will now show all commits and files of the repository. Only master branch will exist | ||
| Line 18: | Line 18: | ||
** Make the master branch unprotected | ** 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. | ** 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=" " | *** OLD_EMAIL=" " | ||
*** CORRECT_NAME=" " | *** CORRECT_NAME=" " | ||
| Line 28: | Line 28: | ||
** delete the backup: | ** delete the backup: | ||
*** git update-ref -d refs/original/refs/heads/master | *** git update-ref -d refs/original/refs/heads/master | ||
** if there are more usernames just repeat the steps from | ** if there are more usernames just repeat the steps from '''Edit the file and replace the values in question'''. | ||
Latest revision as of 16:27, 13 February 2017
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.