How to move an existing site from one svn repository to a new one

This tutorial starts with a situation that can easily occur if you are taking over an existing website from a different developer, and for one reason or another you need to move the site off of the old svn account and on to another one that you or the client control.

There are obviously many ways to achieve this goal, but this is the method that I prefer.

To start open a terminal prompt (or a cywin prompt if you are using Windows) and navigate to the working copy on you local computer. Once in the correct folder type the following command and hit enter:
find . -name ".svn" -exec rm -rf {} \;
This command will remove all the .svn folders and will as a result remove version control from the site.

Next you will need the information from your new repository and you will need to add the files into that repository and commit them just like you would a brand new site. I’m not going to go into that in this tutorial, but you can find instructions easily if you google it.

Once you have the site committed to the new repository ssh into the remote server for the site in question and navigate to the highest level directory associated with the old repository and run the same command as before:
find . -name ".svn" -exec rm -rf {} \;

Now here’s the important part. In that same directory run the following command (obviously changing the details for your repository):
svn checkout --force http://yourrepository.com/svn/pathtospecific_repo .
NOTE: The –force part won’t work on older versions of svn.

If for some reason the files in the current folder are out of date with the repository you just need to run the following command:
svn revert -R .
And voila! You’re done. You can now commit files to the new repository and update the remote version through the command line. You will need to enter the new svn user name and password at least once.

Another thing people who are new to command line work need to pay attention to is that the period in the command isn’t punctuation, it signifies that the command is to be performed on the current folder. This is my preferred approach, however you can also enter a path to the repository rather than navigating to it.