svnsync with PuTTY on Windows
Maintain a copy of my local Subversion repository on my hosting server ready for deployment of my application using Capistrano.
- Create remote svn repository
- Set up svn+ssh using PuTTY on Windows
- Download plink.exe and puttygen.exe to you local machine.
- run puttygen and generate a public/private key pair
Don't set a pass phrase and svn will not prompt you for it later.
- Save the private key to keyfile.ppk on your local hard disk.
- On the remote host open a file ~/.ssh/authorized_keys and paste in the public key from puttygen.
Make sure the string fits on a single continuous line.
- In the file abov, pre-pend command="svnserve -t" to the start of the public key.
This forces the svnserve process to run when ever someone connects using this key pair. Having no passphrase on the key pair isn't great for security but at least you are restricting access to just svn and not the whole shell.
- On the local Windows machine, edit %Application Data%\Subversion\config, under the [tunnels] section add
ssh =plink -i \path\to\keyfile.ppk
(use back slashes / despite it being on Windows)
- Test using svn info svn+ssh://email@example.com/home/username/svn-repos/application
- Set up two environment variables to save on the typing
- Initialise the synchronisation set up
svnsync init %torepos% %fromrepos%
- Check the synchronisation parameters have been correctly set on the remote repository
svn proplist --revprop -r 0 %to%
svn propget svn:sync-from-url --revprop -r 0 %torepos%
- Now do the sync
svnsync sync %torepos%
- Sit back and wait, or in my case, go to bed.
Sources of inspiration: