Monday, March 1, 2010

Subversion and SCPlugin for Mac Behind Authenticating Proxy




image I have been using subversion at work for about a year now. I opted for the common repository server model with VisualSVN Server. VisualSVN Server was a free product that has branched into a free and pay model. The free version has enough to keep a small-time user like me perfectly happy.

We use TortoiseSVN on for PCs and SCPlugin for Macs. TortoiseSVN is amazing - a model for the open source community. SCPlugin is the closest free product I could find for the Mac. It is not as robust as TortoiseSVN, but it works well enough.

Our Macs and PCs are behind a proxy. SCPlugin installs just fine, but we would get this error message when trying to connect to a repository (see fig1).

image


fig 1. Subversion error: OPTIONS of 'repo name': could not connect to server (svn server)


In September of last year, I contacted the author of SCPlugin about this and he said:

SCPlugin does not provide GUI access to the configuration. SCPlugin uses the core Subversion configuration. On UNIX systems, like OS X, it's in the user's home directory, in

~/.subversion/config and
~/.subversion/servers

I found the proxy info I needed in the servers file. After a little experimentation, I was able to provide these instructions to my Mac users:


  1. right click on the finder and "open folder". type: ~/.subversion

  2. In the subversion folder, you should see a file called 'servers'. Double click "servers" to edit the file.

  3. In the servers file, you'll notice a lot of the lines start with #. The pound sign signifies a comment. Just about all of the lines should be commented out.

  4. Immediately beneath the [groups] section type:
    1. somegroupname = subversion.server.name
  5. Create a new group called [somegroupname] and add the following lines beneath it
    1. http-proxy-host = {your server's IP address}
    2. http-proxy-port = 80
    The config file should look similar to this:
    [groups]
    somegroupname = subversion.server.name
    #group1 = *.collab.net
    #othergroup = repository.blarggitywhoomph.com
    #thirdgroup = *.example.com

    [somegroupname]
    http-proxy-host = 123.222.21.1
    http-proxy-port = 80
  6. Scroll down to the bottom of the file and add the following lines to the [global] group
    1. http-proxy-username = {username}
    2. http-proxy-password = {password}
    3. http-compression = no
    4. http-auth-types = basic;digest;negotiate
    The config file should look similar to this:
    ### 'ssl-authority-files' is a semicolon-delimited list of files,
    ### each pointing to a PEM-encoded Certificate Authority (CA)
    ### SSL certificate. See details above for overriding security due to SSL.
    [global]
    http-proxy-username = totallyunsecure
    http-proxy-password = plaintextpassword
    http-compression = no
    http-auth-types = basic;digest;negotiate
    #http-proxy-exceptions = *.exceptions.com, www.internal-site.org, ...
  7. Save the servers file

  8. Test by trying to check out a file with your subversion username and password.