Set up NetBeans to use SVN over SSH

UPDATE: NetBeans 7.0 has much better UI for supporting login credentials using SVN over SSH. The instructions below may prove helpful if for some reason you are stuck with NetBeans 6.9.1. however.

I am liking NetBeans as my PHP/WordPress dev IDE, but I ran into some difficulty recently setting it up to use SVN over SSH. Here’s the solution that I was able to hit upon. If there’s an easier way to do this, please let me know in the comments. These instructions apply to Mac OSX. And, as always, ymmv!

Open up the preferences pane and click on Miscellaneous > Versioning > Subversion.

Make sure to define the path to your SVN executable file. This should be /usr/bin/ on a Mac.

Then click Define Folder > Add with Wizard. Paste the svn+ssh path into the Repository URL, this should be something like: svn+ssh:// Then, for the tunnel command, enter ssh -l yourusername -q.

NetBeans does not natively support the ability to challenge you for your SSH password as part of its UI, so we need to do a little more work. I found an excellent tip here.

You’ll need this script:

#! /bin/sh
# An SSH_ASKPASS command for MacOS X
# Author: Joseph Mocker, Sun Microsystems
# To use this script:
# setenv SSH_ASKPASS "macos-askpass"
# setenv DISPLAY ":0"

DIALOG="display dialog \"$@\" default answer \"\" with title \"$TITLE\""
DIALOG="$DIALOG with icon caution with hidden answer"

result=`osascript -e 'tell application "Finder"' -e "activate" -e "$DIALOG" -e 'end tell'`

if [ "$result" = "" ]; then
exit 1
echo "$result" | sed -e 's/^text returned://' -e 's/, button returned:.*$//'
exit 0

sudo vi /usr/libexec/ssh-askpass
Paste the script, save the file (needs sudo password), make it executable
sudo chmod +x /usr/libexec/ssh-askpass

Now when you try to use Subversion within NetBeans, a dialog box should pop up asking you for your password. It’s not very pretty, but it does the trick!


About jeromecovington

Web Developer. Musician. I think in sounds and work in code.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s