Total Pageviews

Tuesday 7 February 2012

TortoiseSVN and svn+ssh problems

I’ve had problems with TortoiseSVN connecting to a subversion repository on Mac OS X where the connection would just hang when trying to browse or checkout a repository, or would fail with the error “Unable to write to standard output (stderr)”. I show you how to diagnose the problem, and solve it (in my case).
TortoiseSVN is a great Windows Explorer shell extension that allows one to interact with a local or remote Subversion repository easily and efficiently. Subversion is great for keeping track of your academic work - think of “Track Changes” on steroids, a super way of keeping track of changes to files and groups of files. It also makes collaboration easy, if you are collaborating with like-minded individuals who understand the benefits of decent version control rather than trying to keep version information in Microsoft Word.
I’ve previously used two laptops, one running Mac OS X (my main work machine) and one running Windows XP. I synchronise my work by using subversion. I can checkout a working copy of my research files, make changes, and then commit those changes. I don’t tend to get any conflicts, but these are easy to fix (with plain text files anyway). I take special care not to commit binary changes from one working copy before committing changes from the other, as binary conflicts are much harder to deal with.
Since upgrading my Mac (a new Macbook Pro), I’ve had problems connecting. If your copy of TortoiseSVN hangs when trying to connect, or complains about a “Unable to write to standard output (stderr)” error, then try the following: (I assume you use bash as your default shell on the server holding your subversion repository).
Check manual SSH connections work
  • Download Plink (a command line SSH client). Copy this file into C:\WINDOWS
  • Go to START menu->Run
  • Type CMD.EXE
  • Type PLINK.EXE user@host
You should then be able to login to the SSH server running on your machine (Mac OS X, or Linux). Obviously, you will need to run a SSH server on this machine. On the Mac, you just enable “Remote login” from the SHARING pane of System Preferences.
If you can’t login using SSH, then you must have a network problem, or some other problem stopping connections. Ensure you’re using the correct IP address etc.
As long as a normal SSH login worked, you can now move on to the next step:
Check svn+ssh will work
To do this, svnserve must be in the path. This is critical and in UNIX, the path may differ between interactive and non–interactive shells. I use MacPorts which makes it easy for me to install Subversion (port install subversion), but by default, all binaries are installed in /opt/local/bin/.
For interactive shells, bash looks for .profile, and will execute the commands therein. For non-interactive shells, bash looks at .bashrc.
Try this:
  • Type PLINK.EXE user@host svnserve -t
To see whether a non-interactive shell can find your svnserve binary. In my case this was the problem, and adding the required lines to my ~/.bashrc file cured my TortoiseSVN problem.
If you continue to have problems, then the output from PLINK may well be able to offer insight into what is going on (whereas TortoiseSVN doesn’t pass on errors from connections and just seems to silently fail or provide cryptic error messages.
Good luck!

No comments:

Post a Comment