Tuesday, September 30, 2008

Subversion over a network

I previously talked about creating a subversion repository. But it is only of use if people can access it. 

Using svn list there are several protocols that are accepted:
  • file:///Users/svn
  • http://somedomain.com/svn
  • svn://mycomputer/Users/svn
  • svn+ssh://mycomputer/Users/svn
file is used for viewing a repository on your local machine, this approach is not recommended. http is used to view repository served via apache (Binding modules are available for this, see here). svn is the default method, simple but no data encryption. Finally there is svn+ssh, which as the name suggest uses the SSH protocol. This is my method of choice for a group that already uses SSH between workstations.

There are several changes you will need to implement first.
  1. Create an svn user and group.
  2. Change ownership of your repository to the new svn user and group (chown -R svn:svn /Users/svn)
  3. Change the file permissions to read,write, execute for user and group and nothing for other (chmod -R 770 /Users/svn)
  4. That change would of just altered an extra permission, reset it manually now: chmod g+s /Users/svn/repo/db
  5. Add users who can have SSH access to the svn group
  6. To avoid constantly entering your SSH password create a set of keys.
Now you have command-line access sorted! I'd also suggest adding a web interface to view the repository. ViewVC is excellent for this purpose. 

In terms of client applications there are plenty to choose from. Eclipse offers a cross-platform GUI for the repository using either Subclipse or Subversive plug-ins (See my previous post). There are also several other platform specific options: TortoiseSVN (Win), svnX (Mac) and KDEsvn (KDE) come to mind.