windows 如何从命令行将 svn+ssh 与 Tortoise SVN 一起使用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16214136/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to use svn+ssh with Tortoise SVN from the command line
提问by hax0r_n_code
I'm having trouble trying to checkout a repo using the following syntax on a Windows 7 workstation with TortoiseSvn:
我在使用 TortoiseSvn 的 Windows 7 工作站上尝试使用以下语法签出存储库时遇到问题:
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
- 修改 TortoiseSvn 的网络设置指向 ..\TortoisePlink.exe
- 成功建立到目标机器的 ssh 连接,没有任何问题
- 使用 OpenSsh 从运行 Ubuntu 的工作站成功签出存储库
When I try to do the above syntax from the command line on the Windows 7 workstation I get the error:
当我尝试从 Windows 7 工作站上的命令行执行上述语法时,出现错误:
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.
有趣的是,如果我使用 tortoise gui 浏览到 repo,我可以成功打开并查看 repo。但是为了编写脚本,我需要从命令行执行此操作。
Any suggestions?
有什么建议?
回答by zakinster
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 \\
.
要使 svn+ssh 与 Tortoise 一起工作,请确保%SVN_SSH%
设置为您的 ssh 客户端(可能是 Tortoise 或 Putty 的 plink.exe)并且路径必须用正斜杠/
或转义的反斜杠写入\\
。
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
尝试%SVN_SSH%
在转义反斜杠时使用 plink 的绝对路径进行设置,例如C:\\Program Files\\TortoiseSVN\\bin\\TortoisePlink.exe
代替..\TortoisePlink.exe
回答by Lazy Badger
- 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
- 使用 Plink 手动连接到服务器。定义需要和正确的(为您)plink 的启动选项
- 将此行(使用 tortoiseplink 作为 windowless-plink)添加到
%APPDATA%config
文件,[tunnels]
部分
回答by Kevin Sadler
Check that the path to TortoisePlink is not corrupted in your Tortoise SVN config...
检查 TortoisePlink 的路径在你的 Tortoise SVN 配置中没有损坏......
- Start > Program Files > Tortoise SVN > Settings
- Under General Settings, "Subversion configuration file:" click "Edit"
- This will open the config file in Notepad
- Scroll down to the
[tunnels]
section and check the value forssh
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.
- 开始 > 程序文件 > Tortoise SVN > 设置
- 在常规设置下,“Subversion 配置文件:”点击“编辑”
- 这将在记事本中打开配置文件
- 向下滚动到该
[tunnels]
部分并检查ssh
应该取消注释的值,使用双斜杠等 - 我遇到了问题,因为在路径的开头似乎有一个 Unicode 控制代码。
### 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
回答by i'm tired
It also turns out the the line in the Tunnels section of the config file is case sensitive.
事实证明,配置文件的 Tunnels 部分中的行区分大小写。
For example: sh = $SVN_SSH "C:/path/putty/plink.exe" -2 -C -i "C:/path/username/serversvn.ppk" might work
例如: sh = $SVN_SSH "C:/path/putty/plink.exe" -2 -C -i "C:/path/username/serversvn.ppk" 可能会起作用
and
和
sh = $SVN_SSH "C:/path/PuTTY/plink.exe" -2 -C -i "C:/path/username/serversvn.ppk" won't work
sh = $SVN_SSH "C:/path/PuTTY/plink.exe" -2 -C -i "C:/path/username/serversvn.ppk" 不起作用
回答by john stamos
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.
我尝试通过 Pycharm 连接到我们的 SSH+SVN 服务器,但它挂了。通过 Windows 右键单击,tortoiseSVN 尝试了常规方式,并遇到了同样的“无法创建隧道”问题。
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.
我相信这个问题是因为我试图通过 pycharm 连接到我的 repo,它自动在 tortoise SVN 配置文件中创建了一条隧道线。
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.
我跟着凯文萨德勒的回答,只是注释掉了 ssh 行,然后就恢复正常了。检出和提交再次工作。
Kevin's answer:
凯文的回答:
Check that the path to TortoisePlink is not corrupted in your Tortoise SVN config...
检查 TortoisePlink 的路径在你的 Tortoise SVN 配置中没有损坏......
- Start > Program Files > Tortoise SVN > Settings
- Under General Settings, "Subversion configuration file:" click "Edit"
- This will open the config file in Notepad
- Scroll down to the [tunnels] sections. Comment out the SSH line.
- 开始 > 程序文件 > Tortoise SVN > 设置
- 在常规设置下,“Subversion 配置文件:”点击“编辑”
- 这将在记事本中打开配置文件
- 向下滚动到 [tunnels] 部分。注释掉 SSH 行。