How Do I Set Up SSH with Subversion?

This page applies only for JavaHL and CLI Subversion clients. If you're using SVNKit as the preferred client in NetBeans, enter username and password or username, identity key file and passphrase directly in the authentication dialog.

Subversion with the svn+ssh:// access method type is one of the protocols supported in NetBeans that calls for valid settings in the subversion config file. This file is located at:

  • Windows systems: %APPDATA%\Subversion\config
  • Unix systems, including Macintosh: $HOME/.subversion/config>

Open this file and edit the tunnels section:

  • Windows:
# with the use of private key authentication
ssh = $SVN_SSH plink.exe -l <username> -i D:/new_my_private_key.ppk 
# or with password authentication
ssh = $SVN_SSH plink.exe -l <username> -pw password

Putty applications can be downloaded as binaries from the following page: http://www.chiark.greenend.org.uk/sgtatham/putty/download.html

Note: Using plink with NetBeans might be annoying due command prompt window pop-up every time you use subversion functions. You may try TortoisePlink.exe from TortoiseSVN to address the issue. TortoisePlink.exe accepts the same options as plink.exe.

  • Unix-like systems:
ssh = $SVN_SSH ssh -q -l <username> -i identy_file

NOTE that your ssh tunnel command has be specified with the -q switch in case your ssh server is configured to return a banner.

SSH password-caching tools can help if SSH is repeatedly asking for the password. SSH password-caching tools include Pageant (as a part of Putty applications) on Windows and ssh-agent on Unix-like systems. If a key was generated along with the PassPhrase, you have to use the "ssh password-caching" tool.

  • Windows:
  1. Modify the tunnels section of the Subversion config file:
    ssh = $SVN_SSH plink -l <username>
  2. Download and start the Pageant tool. (It is displayed in the system tray).
  3. Open it and add the key. You will be prompted for the PassPhrase.
  • Unix-like systems:
  1. Modify the tunnels section of the subversion config file: //
    ssh = $SVN_SSH ssh -l <username>
  2. Start an ssh agent (use -c for C-shell and -s for Bourne shell env variables) and add your identity:
    ssh-agent [[S| -c]] | head -2 > ~/.agent source ~/.agent ssh-add path_to_indentity_file
  3. Note: this can be done as an alias (e.g., in a .cshrc) and with an associated source command agent only has to be run once per boot (or ssh-agent shutdown). In ~/.cshrc:
    alias agent 'ssh-agent | head -2 > ~/.agent; source ~/.agent;ssh-add'source ~/.agent
  4. Start NetBeans IDE either
  • from the same terminal.
  • or from a wrapper script (e.g., for panel buttons)

source ~/.agent

/usr/local/netbeans-6.0.1/bin/netbeans &

Tunneling SSH through a Proxy:

This section describes how to tunnel through an http-proxy server without any server-side modifications.

  • Windows:
    1. Start Putty application.
    2. Select the Connection | Proxy item. Set required Proxy type and fill Proxy hostname, Port. (If the proxy server asks for authentication, fill in a valid Username and Password)
    3. Now select Session item again and enter the session name into Saved Sessions field. (session name must match the hostname of the subversion repository. For example: for the Repository URL https://peterp.org/svnrepo the session name has to be peterp.org)
    4. Save the session.
  • Unix-like systems:
    1. Download and extract corkscrew.
    2. In the corkscrew directory type: ./configure, make and make install
    3. Add a new line to your ~/.ssh/config
#replace the http proxy and port settings with the correct values
ProxyCommand /usr/local/bin/corkscrew proxy.example.com 8080 %h %p
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo