I’ve been using subversion for a few years now. Initially used through subclipse within Eclipse/Flex Builder then later also used with Dreamweaver sites using tools such as svnX and scplugin along with the “Cloak SCM directories” command. In most cases to date, I have used the “file:///” protocol as this provides direct and efficient access to repositories which are available within the local system or local area network. I had been looking forward to subversion integration in Dreamweaver and when the CS4 public beta was released I had a bit of a moan about the absence of the file protocol. Despite my efforts in the beta’s forum and the Dreamweaver wish-list, it remains absent. So now to look to using a different protocol.
There is a helpful 3 part article on the Adobe site describing how to get started with dreamweaver CS4 and svn. In part 3, the author chooses to present how jump through the hoops to get Apache to serve and access a local repository over http. There are a number of reasons why this approach is not right for me:
- svn served using mod_dav_svn through Apache over http is less efficient than svnserve through ssh.
- I have multiple repositories, one per project and all stored on a separate project disc. To use the http method, I would need to edit httpd.conf to add a directory mapping and manage access rights for each repository.
By using svn+ssh, svnserve launches on demand (no need for a running daemon) and we have access to all the paths available to the ssh user logged in.
So, to get this going on Mac OS X 10.5…
Turn on ‘Remote Login’ in the ‘Sharing’ system preferences. Rather than using the default of allowing access for all users, I restricted access to only my user.
At this point you should be able to use sv+ssh urls from within terminal. e.g.
% svn info svn+ssh://firstname.lastname@example.org/Volumes/full/path/to/repository
However if you try to use the same connection in a tool such as svnX you are likely to get error : ssh_askpass: exec(/usr/libexec/ssh-askpass): No such file or directory
To get around this we really need to establish public key authentication, which also serves to avoid you having to use your user account’s name and password for the connection. Based upon this article on OpenSSH, I did the following:
% cd .ssh
% ssh-keygen -q -f id_rsa -t rsa
Update 16-Feb-2009: Since writing this and applying an number of mac system and security updates i today found that any attempt to ssh+svn would result in…svnserve: Command not found. svn: Connection closed unexpectedly [exit=1]command="/usr/bin/svnserve -t"
As this is my one and only public key, I simply uses the following line to copy the public key to a file called ‘authorized_keys’. However if you are dealing with more than one key, you should use the guaidance in the OpenSSH article to append the key to that file.
% cp id_rsa.pub authorized_keys
Once this has been done, attempting to use your svn+ssh url within svnX should now work. Note: you may get the error re-displayed, but it will dismiss to be replaced by a current view of the repository. Also the first time, you will be prompted for the password. Here you need to enter the passphrase you used when you created the rsa key. I chose for this to be remembered in my keychain to avoid having to retype it in future.
With this done, you are now ready to contemplate setting up Dreamweaver. You need to be aware that an subversion working copy knows the url to the repository from which it was checked out. If your existing DW local copies of sites are subversion working copies checked out like mine via the ‘file:///’ protocol, you need to migrate them to ‘svn+ssh://’ so:
- Firstly ensure that everything you need to retain from your working copy has been committed to the repository
- Drag your working copy to the trash
- Create a new folder to contain your local site
- In Dreamweaver create a new site and manage the settings accordingly, pointing the local site to the folder you just created.
- In the version control category of the site definition, choose ‘Access Subversion’
- Protocol SVN+SSH
- Server address is your local computer. i.e. ‘computername.local’
- Repository path is a full path to the repository then further on down to the folder containing the site. In my case, each repository is split into trunk, branches and tags folders, and my site folder named ‘webroot’ is a sub-directory of trunk. So my path will read:
- Server port remains default
- Provide your user name
- Leave password blank. The connection will be authenticated using the RSA public key
- Click the test button and you should get the message “Server and project are accessible!”
- CLick ‘Ok’, to leave the site definition
- In the file view, right-click the site folder and choose Version control > Get latest versions
- The latest versions of the files in the repository will be checked out of the repository into your local folder which will now become a working copy.