xcode SVN+SSH 连接报错 210002,网络连接意外关闭

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1861518/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 18:59:37  来源:igfitidea点击:

SVN+SSH Connection Giving Error 210002, Network Connection Closed Unexpectedly

svnxcodehttpssh

提问by Michael T.

OK, I'm having a problem settings up SVN+SSH.

好的,我在设置 SVN+SSH 时遇到问题。

I have SVN running on a Linux server and trying to connect from a Mac laptop running Snow Leopard. XCode tries to connect, but gives the message "Error 210002, network connection closed unexpectedly."

我在 Linux 服务器上运行 SVN,并尝试从运行 Snow Leopard 的 Mac 笔记本电脑进行连接。XCode 尝试连接,但给出消息“错误 210002,网络连接意外关闭”。

Nothing online seems to explain. I connect using xcode with HTTP and it works correctly for all repositories.

网上好像没有解释。我使用 xcode 和 HTTP 进行连接,它适用于所有存储库。

Here's my SVN vesrion:

这是我的 SVN 版本:

svn, version 1.5.4 (r33841)
compiled Aug  7 2009, 01:44:11

Copyright (C) 2000-2008 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).

The following repository access (RA) modules are available:

* ra_neon : Module for accessing a repository via WebDAV protocol using Neon.
  - handles 'http' scheme
  - handles 'https' scheme
* ra_svn : Module for accessing a repository using the svn network protocol.
  - with Cyrus SASL authentication
  - handles 'svn' scheme
* ra_local : Module for accessing a repository on local disk.
  - handles 'file' scheme

I currently have it set up to use http, which works without problems.

我目前已将其设置为使用 http,它可以正常工作。

http://[email protected]/svn/project

I can ssh to the server using username and password, and run commands such as

我可以使用用户名和密码 ssh 到服务器,并运行诸如

svn list file:///home/svn/project

and I get a listing of the contents of that project. So, I don't think it's a permissions problem.

我得到了那个项目的内容清单。所以,我认为这不是权限问题。

Files on server are at /home/svn/project.

服务器上的文件位于 /home/svn/project。

I'm trying to get this to work in XCode. Doesn't work using the path as /home/svn/project or just /svn/project as works in http.

我试图让它在 XCode 中工作。使用路径作为 /home/svn/project 或仅使用 /svn/project 作为 http 中的工作不起作用。

But, from the laptop, the following command does list info as expected:

但是,在笔记本电脑上,以下命令确实按预期列出信息:

svn list svn+ssh://[email protected]/home/svn/project
[email protected]'s password:
branches
tags
trunk
Killed by signal 15.

The program svnserve isn't running, but the user I'm logging in with has the ability to run it. If I do start it in foreground mode, it doesn't seem to change anything.

程序 svnserve 没有运行,但我登录的用户可以运行它。如果我确实在前台模式下启动它,它似乎没有任何改变。

Any ideas what I'm missing. Would love to be able to run svn+ssh and turn off http access.

任何想法我所缺少的。希望能够运行 svn+ssh 并关闭 http 访问。

Cheers!

干杯!

EDIT

编辑

For some more information, I found that it's only one repository. All other repositories on the server seem to be working correctly with SVN+SSH.

有关更多信息,我发现它只是一个存储库。服务器上的所有其他存储库似乎都可以使用 SVN+SSH 正常工作。

It seems to be an XCode bug, but I don't know for sure. It's something about how XCode reads SSH connection information that may be cached in the computer.

这似乎是一个 XCode 错误,但我不确定。它是关于 XCode 如何读取可能缓存在计算机中的 SSH 连接信息的。

回答by sl.

To suppress "killed by signal 15" messages please set SVN_SSH="ssh -q"as mentioned here.

要抑制“被信号 15 杀死”消息,请SVN_SSH="ssh -q"此处所述进行设置。

回答by gotgenes

Does your server have a firewall, and if so, does it limit the number of SSH connection attempts, such as by the method described here? We were experiencing the exact same problem of having the connection dropped for svn checkout, but not for svn ls, over svn+ssh://. We adjusted the connection settings on the firewall to be more lenient, allowing more connections per minute, and this instantly cleared our problems. It seems that SVN is very aggressive in initiating connections during certain operations, and less so for others.

您的服务器是否有防火墙,如果有,它是否会限制 SSH 连接尝试的次数,例如通过此处描述的方法?我们遇到了完全相同的问题,即连接断开了svn checkout,但没有svn ls结束svn+ssh://。我们将防火墙上的连接设置调整得更宽松,每分钟允许更多连接,这立即解决了我们的问题。似乎 SVN 在某些操作期间发起连接非常积极,而在其他操作中则不然。

回答by Dave Bacher

That 'Killed by signal 15' is a clue that something is not quite right even with your command line usage. I remember fixing the same issue, but don't remember the exact cause. I think it had to do with how I was handling my non-standard ssh port and having a different username on my local computer and the remote server.

'Killed by signal 15' 是一个线索,即使您使用命令行,某些事情也不太正确。我记得解决了同样的问题,但不记得确切原因。我认为这与我如何处理非标准 ssh 端口以及在本地计算机和远程服务器上使用不同的用户名有关。

Does your svn host have a non-standard ssh port and/or different username? I switched from using a SVN_SSH variable to set the port to putting a proper entry in my .ssh/config file that set both the username and port for the ssh connection.

您的 svn 主机是否有非标准的 ssh 端口和/或不同的用户名?我从使用 SVN_SSH 变量设置端口切换到在我的 .ssh/config 文件中放置一个正确的条目,为 ssh 连接设置用户名和端口。

Host example.com
  User username
  Port port

I'm not sure whether xcode respects your .ssh/config though.

我不确定 xcode 是否尊重您的 .ssh/config。

回答by puiseux

None of solutions given here worked with svn+ssh, but I could connect and checkout via https:

此处给出的解决方案均不适用于svn+ssh,但我可以通过https以下方式连接和结帐:

$ svn checkout --username myusername https://scm.gforge.inria.fr/svn/concha

回答by Matthias

I had the same problem with "Killed by signal 15.", btw. Adding host, user and port to the .ssh/configdid not resolve this problem.

我在“被信号 15 杀死”时遇到了同样的问题,顺便说一句。将主机、用户和端口添加到.ssh/config没有解决此问题。

OSX 10.5/10.6 doesn't document the flag -q (that's why at least I ignored this advice, as sl suggested, for a long time), but it does work on OSX 10.5 (surely on 10.6, too, but I don't have it). In ~/.subversion/config, I added

OSX 10.5/10.6 没有记录标志 -q(这就是为什么我很长一段时间都忽略了这个建议,正如 sl 建议的那样),但它确实适用于 OSX 10.5(当然也适用于 10.6,但我不没有它)。在 中~/.subversion/config,我添加了

ssh = $SVN_SSH ssh -q -o ControlMaster=no

somewhere around line 55 (if yours is still fresh out of the box, it probably has a commented out line very similar to this right there). The -o ControlMaster=nodeals with another ssh setting that I have, that otherwise breaks this entirely.

在第 55 行附近的某个地方(如果你的仍然是开箱即用的,它可能有一条与此非常相似的注释行)。在-o ControlMaster=no另一个SSH设置,我有,否则打破这个完全交易。

回答by Rick

Here's how I fixed this (on Mac OS X, but fix should work on any client).

这是我修复此问题的方法(在 Mac OS X 上,但修复应该适用于任何客户端)。

This particular issue arises when you are using a non-standard port (let's say 12001 for sake of example) for your SSH server.

当您为 SSH 服务器使用非标准端口(例如,假设为 12001)时,就会出现这个特殊问题。

Apparently the SVN client experiences syntax errors when given a port address on a command line like this one:

显然,当在命令行上给定端口地址时,SVN 客户端会遇到语法错误:

svn list svn+ssh://[email protected]:12001/home/username/svn/myproject

So, to fix this, you need to create a client-side config file for SSH like this:

因此,要解决此问题,您需要为 SSH 创建一个客户端配置文件,如下所示:

cd ~
cd .ssh
vi config (create a config file like the one that follows)
:w
:q

Config file located in ~/.ssh/config:

配置文件位于~/.ssh/config

Host domain.com
  User username
  Port 12001

Then, issue your svn+ssh command WITHOUT the port like this:

然后,在没有端口的情况下发出 svn+ssh 命令,如下所示:

svn list svn+ssh://[email protected]/home/username/svn/myproject