How to use SVN over SSH tunnel (svn+ssh) with PushOK SVNSCC plug-in
This instruction assumes the following things:
-
you already have a user account on a Unix server;
-
the user have permissions to access to the Subversion repository, located on
this server;
-
you can access this server using SSH.
There are several ways of setting up your environment to work with svn+ssh://
protocol. First we will describe the recommended one, but if it is not suitable
for you, there are some alternative configurations
mentioned further.
The recommended configuration
Perform the following steps to set up your environment.
-
TortoisePlink.exe will be needed for SSH authentication and tunnelling. So you
have to install TortoiseSVN (http://tortoisesvn.net/).
-
Install PuTTY - a free SSH client for Windows (http://www.chiark.greenend.org.uk/~sgtatham/putty/).
-
Go to "System properties" / "Advanced" / "Environment Variables..."
and create the SVN_SSH variable which
points to TortoisePlink.exe file. Note that you sould use
forward slash (/) or paired backslash (\\) instead of single backslash (\).
Now you can already access the repository using the following URL
schema: "svn+ssh://username@hostname/path/to/repository". But the
plug-in makes many connections to repository, and you will be prompted for
a password every time a new connection requested. This is because all
authentication is performed by SSH itself, therefore
Subversion password caching feature does not work. So the next step
is to set up a key authentication for SSH.
-
Generate a new SSH-2 RSA private/public key pair or convert your
existing private key to PuTTY format using PuTTYgen utility.
-
Put your public key on the server. If it doesn't already exist, create the
authorized_keys file (on Unix, typically ~/.ssh/authorized_keys). Each line in
this file describes a public key that is allowed to connect. Place your public
key here.
-
Open PuTTY. Enter hostname or IP address of the server.
-
Under "Connection" / "Data" enter the user name in the "Auto-login username"
field.
-
Under "Connection" / "SSH" / "Auth" click on "Browse..." and point on your
private key file.
-
Go back to the "Session" category. Enter the session name and click
"Save".
-
Open the session you have just created. It should not prompt you for username
and password, because a key authentication is used now. If you logged in
successfully, this means that SSH configured correctly.
-
Now you can connect to repository using the session name instead of
username@hostname, for example "svn+ssh://svnsrv/usr/svn". Open your
IDE and work with your projects as usual. Note that the username provided by
the IDE will be ignored.
Hints
Specifying the private key file directly in the SVN_SSH variable
You can use key authentication without saving of a PuTTY session. Just
specify a path to the private key file as a parameter
of TortoisePlink.exe in the SVN_SSH variable. For example,
set SVN_SSH="C:/Program Files/TortoiseSVN/bin/TortoisePlink.exe" -i C:/ssh/id_rsa.ppk
With this configuration you should specify the user name and the host name (or
IP address) directly in the SVN URL, for example svn+ssh://user@192.168.0.1/var/svn. Alternative
way is to specify the user name as an additional parameter for
TortoisePlink:
set SVN_SSH="C:/Program Files/TortoiseSVN/bin/TortoisePlink.exe" -i C:/ssh/id_rsa.ppk -l username
Using the configuration file instead of the environment variable
You can use Subversion configuration file instead of the SVN_SSH environment
variable. Usually it is located in user's folder, for example "C:\Documents and
Settings\UserName\Application Data\Subversion\config ". The file
already contains the description of available parameters. Place
your SSH configuration in the [tunnels] section of the file. For
example,
[tunnels]
ssh = $SVN_SSH "C:/Program Files/TortoiseSVN/bin/TortoisePlink.exe" -i C:/ssh/id_rsa.ppk
Using other SSH clients
You can use plink.exe from PuTTY or ssh.exe from
OpenSSH instead of TortoisePlink.exe. The main disadvantage of
this utilities is that console window appears when the utility started.
TortoisePlink is a modified version of PuTTY plink, that uses graphical windows
instead of a text console. It shares configuration settings with
PuTTY. If you wish to use OpenSSH client as a tunneling tool, you should set up
key authentication for it in a different way, not as described above. The
detailed description of this procedure included in the OpenSSH distribution
(refer to the "Key Based Authentication" document).
plink hangs under VMware with Windows 2000 installed
While testing our software under VMware with Windows 2000 installed we have
noticed that plink.exe sometimes hangs after a
TCP/IP connection with a server was established, but before logging
in. It also applies to TortoisePlink.exe. At the same time
under Windows XP the same version of plink.exe works perfectly
with the same server. If you have encountered such a problem, try to use
bridged network connection instead of NAT connection for your virtual machine.