Monday 10 September 2012

Migration from SVN to GITORIOUS and move into GITHUB


1.      svn co svn://serverip/svn/repo
2.      cd repo
3.      svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors-transform.txt
4.      vi authors-transform.txt
5.      svn info
6.      git svn clone svn://serverip/svn/repo --no-metadata -A authors-transform.txt --stdlayout /root/repo
7.      cd /root/repo
8.      git remote add origin git@git.abc.com:test/myrepo.git
Remove .SVN folder from GIT
find . -type d -name .svn -exec git rm -rf {} \;
To create a duplicate of a repo without forking, you need to run a special clone command against the original repo and mirror-push to the new one. This works with any git repo, not just ones hosted on GitHub.

overall workflow for migration will be as follow
1) Make Gitorious  repo read only so that nobody can push to git repo
2) Do git clone with bare -- flag from Gitorious
3) Do push --mirror to github
4) Ask developers to change remote to github (Each developer will have to do this step)
Lets do this thing!
In order to make an exact duplicate, you need to perform both a bare-clone and a mirror-push:
git clone --bare https://github.com/exampleuser/old-repo.git# Make a bare clone of the repo

cd old-repo.git
$ git push --mirror https://github.com/exampleuser/new-repo.git# Mirror-push to the new repo

cd ..
$ rm -rf old-repo.git# Remove our temporary local repo
Every Developer needs to following stepcd existing-working-copygit remote set-url origin git@github.com:/exampleuser/new_repo.git# change remote for existing clone pointing to old repo. Command above will set local clone to use new repo as remote

No comments:

Post a Comment