Xcode svn+ssh 自定义端口不起作用?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3708321/
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
Xcode svn+ssh custom port not working?
提问by Erik B
So we used to use port 22 for our svn repository, but port 22 was recently closed by the firewall administrator, which forced us to use a different port.
所以我们过去使用端口 22 作为我们的 svn 存储库,但是端口 22 最近被防火墙管理员关闭,这迫使我们使用不同的端口。
Anyway, it seems like Xcode doesn't play very well with custom port numbers, because as soon as you change the port number to anything, even 22, you get the following error message:
无论如何,Xcode 似乎不能很好地处理自定义端口号,因为只要将端口号更改为任何内容,甚至 22,就会收到以下错误消息:
Error: 210002 (Network connection closed unexpectedly) Description: (null)
错误:210002(网络连接意外关闭)描述:(空)
That seems to be the error message you get as soon as something isn't working, which isn't very helpful.
这似乎是您在出现问题时立即收到的错误消息,这不是很有帮助。
Setting the port makes the URL look like this:
设置端口使 URL 看起来像这样:
svn+ssh://user@host:22/path
I tried connecting to ssh from the command line using:
我尝试使用以下命令从命令行连接到 ssh:
ssh user@host:22
and got the following error message:
并收到以下错误消息:
ssh: Could not resolve hostname host:22: nodename nor servname provided, or not known
ssh: 无法解析主机名 host:22: nodename 或 servname 提供,或未知
However, if I connect using:
但是,如果我使用以下方法连接:
ssh user@host -p 22
It works.
有用。
This makes me believe that ssh doesn't parse user@host:22 correctly.
这让我相信 ssh 没有正确解析 user@host:22。
Does anyone know how I can change the URL to make it work in Xcode?
有谁知道我如何更改 URL 以使其在 Xcode 中工作?
If anyone knows how to change the url to make it work with ssh, that could be helpful too.
如果有人知道如何更改 url 以使其与 ssh 一起使用,那也可能会有所帮助。
Thanks!
谢谢!
回答by Erik B
What you need to do to change the port of svn over ssh is to add a custom scheme. This is how you do it
要通过 ssh 更改 svn 的端口,您需要做的是添加自定义方案。这就是你的方式
Add the line:
添加行:
ssh2222 = /usr/bin/ssh -p 2222
to the file ~/.subversion/configin the [tunnels]section.
到文件〜/的.subversion /配置在[隧道]部分。
Then use a URL that looks like this:
然后使用如下所示的 URL:
svn+ssh2222//user@host/path
You can name your scheme whatever you want and your port number does of course not have to be 2222.
您可以随意命名您的方案,您的端口号当然不必是 2222。
回答by Carsten
Another alternative (at least with my Subversion 1.6.17) is to use the $SVN_SSHvariable in the config file:
另一种选择(至少对于我的 Subversion 1.6.17)是在配置文件中使用$SVN_SSH变量:
[Tunnels]
ssh = $SVN_SSH ssh -p 2222