Showing posts with label scp. Show all posts
Showing posts with label scp. Show all posts

Saturday, May 9, 2009

Moving an entire SVN repository to a public server

Suppose you have an SVN repository on a workstation at home. And suppose your home workstation does not act as a server on the public internet. It may eventually come time to move the entire SVN repository from your home workstation to a server that is on the public internet. Here's how.

The Subversion Book chapter on moving and removing repositories says the following:

Subversion repository data is wholly contained within the repository directory. As such, you can move a Subversion repository to some other location on disk, rename a repository, copy a repository, or delete a repository altogether using the tools provided by your operating system for manipulating directories—mv, cp -a, and rm -r on Unix platforms ...

You might at first think this means that UNIX scp will be enough to move an entire SVN repository from your home workstation to a server on the public internet. But this is not the case.

Enter svnadmin dump and svnadmin load.

On your home workstation, change to you svn directory and find the repository that you want to move. Make sure you find the repository and not merely a working copy of the repository:

$ cd /var/svn

Redirect the stdout from svnadmin dump to create a dumpfile:

$ svnadmin dump my_repository > my_repository_dumpfile

Copy the dumpfile to the remote server:

$ scp my_repository_dumpfile tbaca@128.129.130.22:/home/tbaca/svn

Log in to the remote server:

$ ssh -l tbaca 128.129.130.22

Switch to the appropriate directory on the remote server:

$ cd /home/tbaca/svn

Create the new repository, if it does not yet already exist:

$ svnadmin create my_repository

Load the dumpfile into the new repository, directing from stdin:

$ svnadmin load my_repository < my_repository_dumpfile

Done.

Tuesday, May 6, 2008

scp quick reference

Copy the file "foobar.txt" from a remote host to the local host

$ scp your_username@remotehost.edu:foobar.txt /some/local/directory

Copy the file "foobar.txt" from the local host to a remote host

$ scp foobar.txt your_username@remotehost.edu:/some/remote/directory

Copy the directory "foo" from the local host to a remote host's directory "bar"

$ scp -r foo your_username@remotehost.edu:/some/remote/directory/bar

Copy the file "foobar.txt" from remote host "rh1.edu" to remote host "rh2.edu"

$ scp your_username@rh1.edu:/some/remote/directory/foobar.txt \
your_username@rh2.edu:/some/remote/directory/

Copying the files "foo.txt" and "bar.txt" from the local host to your home directory on the remote host

$ scp foo.txt bar.txt your_username@remotehost.edu:~

Copy multiple files from the remote host to your current directory on the local host

$ scp your_username@remotehost.edu:/some/remote/directory/\{a,b,c\} .
$ scp your_username@remotehost.edu:~/\{foo.txt,bar.txt\} .