简体   繁体   中英

How to use svn+ssh with Tortoise SVN from the command line

I'm having trouble trying to checkout a repo using the following syntax on a Windows 7 workstation with TortoiseSvn:

svn co svn+ssh://user@ip/repo .

What I've done to test this issue:

  • Modified the network settings of TortoiseSvn to point to ..\\TortoisePlink.exe
  • Successfully established an ssh connection to the target machine with no issues
  • Successfully checked out repos from workstations running Ubuntu with OpenSsh

When I try to do the above syntax from the command line on the Windows 7 workstation I get the error:

svn: E720087: Unable to connect to a repository at URL 'svn+ssh:///user@ip/repo'
svn: E720087: Can't create tunnel:The parameter is incorrect.

Interestingly, if I use the tortoise gui to browse to the repo I can successfully open and check out the repo. But I need to do it from the command line for scripting purposes.

Any suggestions?

For svn+ssh to work with Tortoise, make sure %SVN_SSH% is set to your ssh client (probably plink.exe from Tortoise or Putty) and the path must be written either with forward slashes / or with escaped backslashes \\\\ .

Try to set %SVN_SSH% with the absolute path of plink while escaping the backslashes, something like C:\\\\Program Files\\\\TortoiseSVN\\\\bin\\\\TortoisePlink.exe instead of ..\\TortoisePlink.exe

  • Connect to server, using Plink, by hand. Define needed and correct (for you) startup-options of plink
  • Add this line (use tortoiseplink as windowless-plink) into %APPDATA%config file, [tunnels] section

Check that the path to TortoisePlink is not corrupted in your Tortoise SVN config...

  1. Start > Program Files > Tortoise SVN > Settings
  2. Under General Settings, "Subversion configuration file:" click "Edit"
  3. This will open the config file in Notepad
  4. Scroll down to the [tunnels] section and check the value for ssh which should be uncommented, use double slashes etc - I had problems as there seemed to be a Unicode control code at the beginning of the path.
### On Windows, if you are specifying a full path to a command,
### use a forward slash (/) or a paired backslash (\\) as the
### path separator.  A single backslash will be treated as an
### escape for the following character. 
ssh = C\:\\Program Files\\TortoiseSVN\\bin\\TortoisePlink.exe

It also turns out the the line in the Tunnels section of the config file is case sensitive.

For example: sh = $SVN_SSH "C:/path/putty/plink.exe" -2 -C -i "C:/path/username/serversvn.ppk" might work

and

sh = $SVN_SSH "C:/path/PuTTY/plink.exe" -2 -C -i "C:/path/username/serversvn.ppk" won't work

I had a similar, but slightly different issue.

I tried connecting to our SSH+SVN server through Pycharm and it hung. Tried the regular way through windows right click, tortoiseSVN and got this same "Can't create tunnel" issue.

I believe this issue was created because I tried to connect to my repo via pycharm, which automatically created a tunnel line in the tortoise SVN config file.

I followed Kevin Sadler's answer, but just commented out the ssh line, and it was back to normal. Checkouts and commits were working again.

Kevin's answer:

Check that the path to TortoisePlink is not corrupted in your Tortoise SVN config...

  1. Start > Program Files > Tortoise SVN > Settings
  2. Under General Settings, "Subversion configuration file:" click "Edit"
  3. This will open the config file in Notepad
  4. Scroll down to the [tunnels] sections. Comment out the SSH line.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM