svn+ssh:// and svnX
As I mentioned earlier, I recently got myself a RubyForge account, so that I could commit some critical security fixes to the main branch of Instiki.
RubyForge uses svn+ssh://
for developer access to their SVN repositories. So I went off in search of instructions for using svn+ssh://
with my favourite GUI SVN client, svnX. Unfortunately, all of the advice I found on the web was either overly-complicated or wrong (or both). So, herewith, are my notes for setting up svn+ssh://
access to RubyForge or other, similar, services.
First, let’s create a new SSH key-pair for ourselves, one which we will use exclusively with RubyForge.
% ssh-keygen -t rsa1 -f /Users/yourname/.ssh/rubyforge
and hit return 3 times, creating a key-pair without passphrase protection. “No passphrase?!” I hear you cry. Yes, I know. This is necessary. The secret key is, nominally, only readable by you and we minimize the possible fallout should someone nonetheless manage to compromise it by using this key-pair only with this one service.
Note, also, the “-t rsa1
”. RubyForge uses the SSH level-1 protocol, so we need to create a key-pair in a compatible format. For most other services, this option (and the “Protocol=...
” line, below) can be omitted.
Now we upload the file ~/.ssh/rubyforge.pub
on their web form, and wait a while.
In the meantime, let’s edit ~/.ssh/config
and add the lines
Host = rubyforge.org
Protocol = 1
IdentityFile = /Users/yourname/.ssh/rubyforge
to the end of the file.
We should be able to come back later and do an
% ssh rubyforge.org
and login (and be immediately logged out) without being prompted for a password. Good.
Similarly
% svn list svn+ssh://rubyforge.org/var/svn/yourproject
should also work without being prompted for a password.
Finally, in svnX, we add an new repository with the above URL as its path, and with the User and Password fields left blank.
And. It. Just. Works.
(Here’s where it was important to create the key-pair without a passphrase. svnX has no way to prompt you for a passphrase, so the public key authentication would fail, if we actually needed to enter one.)
The same technique (modulo the bit about the level-1 Protocol) should work with other svn+ssh://
services.
Re: svn+ssh:// and svnX
When I use svn+ssh, I avoid the need to enter a passphrase by running an ssh agent and registering the identity with “ssh-add”.
I know that I’ve seen graphical ssh agent programs for the Mac, but I just use the built in one directly using the technique described on this site (including the improved syntax from comment #2). Once it’s set up, you just need to run “ssh-add” from a Terminal window once and then you’re set until your next full shutdown.