RUNNING SVN+SSH
References
[For a brief SVN tutorial, see Peter
Teuben's website. The book Pragmatic
Version Control: Using Subversion is also a nice reference.
Finally, some SVN
humor.]
The goal is to check-out (or import, or whatever) a repository from a
remote server (the file system where the repository resides) to a
client machine (your local computer). This is not necessary over a
local network (e.g., NFS), only when accessing a remote network.
The benefits of using svn+ssh, rather than logging into the remote
filesystem, are obvious--you can use whatever tools you have on your
local computer to manipulate things that you check-out from the
repository.
When trying to access a repository on Maryland's Astronomy Department
networked file system from a client machine, the following command
results in an error:
% svn co svn+ssh://user@location.edu/repository/location working_directory
svnserve: Command not found.
svn: Connection closed unexpectedly
The reason for the error is that svnserve is not in the remote
server's default path.
To solve this problem, we use public keys.
- From the $HOME/.ssh directory on the client machine, create a
private/public key pair using `ssh-keygen'. Name the file something
unique to subversion (e.g., `id_rsa.svn'). The key will require a
passphrase, which you will use any time you access the remote
server.
- Copy the public part of this key (id_rsa.svn.pub) to the
$HOME/.ssh directory on the remote server.
- On the remote server, copy the public part of the key to
$HOME/.ssh/authorized_keys (or edit this file to include a line
containing the contents of the public key file).
- To the beginning of this line, add the phrase
command="/path/to/svnserve -t" [ssh-rsa ....] In Maryland's Astro
Dept, the location is /n/astromake/bin/svnserve.
- Create the following environment variable on the client machine:
setenv SVN_SSH "ssh -i $HOME/.ssh/private_key_filename"
- Run SVN!
The first svn+ssh command that you run (e.g., the example above) will
ask for the key passphrase 3 times, but later ones will only request
it once. (There may be some other rules governing how many times it
asks for a passphrase.)
Happily, further commands after checkout (e.g., `svn commit' or `svn
update') do not require specifying the remote filesystem again.