migrate from file to svn+ssh for Dreamweaver CS4 on Mac

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:

  1. svn served using mod_dav_svn through Apache over http is less efficient than svnserve through ssh.
  2. 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://[email protected]/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
% cd .ssh
% ssh-keygen -q -f id_rsa -t rsa

If the .ssh directory doesn’t exist, then use mkdir to create it. ssh-keygen creates both public and private keys.

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]

To solve the issue (based on notes here and here) I prefixed line 1 of id_rsa.pub with:

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:

  1. Firstly ensure that everything you need to retain from your working copy has been committed to the repository
  2. Drag your working copy to the trash
  3. Create a new folder to contain your local site
  4. In Dreamweaver create a new site and manage the settings accordingly, pointing the local site to the folder you just created.
  5. In the version control category of the site definition, choose ‘Access Subversion’
  6. Protocol SVN+SSH
  7. Server address is your local computer. i.e. ‘computername.local’
  8. 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:  /Volumes/full/path/to/repository/trunk/webroot
  9. Server port remains default
  10. Provide your user name
  11. Leave password blank. The connection will be authenticated using the RSA public key
  12. Click the test button and you should get the message “Server and project are accessible!”
  13. CLick ‘Ok’, to leave the site definition
  14. In the file view, right-click the site folder and choose Version control > Get latest versions
  15. 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.

Job done.

Posted by creacog

Product Owner/Manager; Digital Project Manager, ex-Developer Available for Product Owner roles

3 comments

[…] Updated my previous article on using svn+ssh with DreamWeaver with a solution. […]

Great article for getting Dreamweaver working with svn+ssh on a mac. On a side-note, I had to add the rsa public key to ~/.ssh/authorized_keys to enable ssh login using the key.

@mallchin – yep, my steps assumed the key is the first/only one. Certainly worth highlighting that ~/.ssh/authorized_keys is a file which can contain multiple keys.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.