TortiseSVN svn+ssh错误:无法连接到URL中的存储库……网络连接意外关闭。

时间:2022-10-28 00:15:39

I'm having problems accessing an SVN repository using TortoiseSVN 1.7.8.

我使用玳瑁1.7.8访问SVN储存库有问题。

The SVN repository is on a CentOS 6.3 box with openssh 5.3p1:81.el6 and appears to be functioning correctly.

SVN储存库使用openssh 5.3p1:81的CentOS 6.3框。el6看起来功能正常。

# svnadmin --version
# svnadmin, version 1.6.11 (r934486)

I can access the repository from another CentOS box with this command:

我可以使用这个命令从另一个CentOS框访问存储库:

svn list svn+ssh://USER@xxx.xx.xx.xxx/var/svn/joetest

But when I attempt to browse the repository using TortiseSVN from a Win 7 workstation I'm unable to do so using the following path:

但是,当我试图从Win 7工作站中使用TortiseSVN浏览存储库时,我无法使用以下路径:

svn+ssh://USER@xxx.xx.xx.xxx/var/svn/joetest

I receive the following error from TortoiseSVN:

我从玳瑁得到如下错误:

Unable to connect to a repository at URL 'svn+ssh://USER@xxx.xx.xx.xxx/var/svn/joetest' To better debug SSH connection problems, remove the -q option from 'ssh' in the [tunnels] section of your Subversion configuration file. Network connection closed unexpectedly

无法连接到URL 'svn+ssh:// user@xxxx .xx.xx的存储库。xxx/var/svn/joetest“为了更好地调试SSH连接问题,从您的Subversion配置文件的[隧道]部分中删除‘SSH’中的-q选项。网络连接意外关闭

I'm able to login via SSH from the workstation using Putty.

我可以使用Putty从工作站登录SSH。

The results are the same if I attempt access as root.

如果我尝试以root身份访问,结果是相同的。

I've given ownership of the repository /var/svn/ to USER:USER and ran
chmod 2700 -R /var/svn/.

我已经拥有了存储库/var/svn/对用户的所有权:用户和运行chmod 2700 -R /var/svn/。

Because I can access the repository via ssh from another Linux box, permissions don't appear to be the problem.

因为我可以通过ssh从另一个Linux box访问存储库,所以权限看起来不是问题。

When I watch the log file using tail -fn 2000 /var/log/secure, I see the following each time TortiseSVN asks for the password:

当我使用tail -fn 2000 /var/log/secure查看日志文件时,我每次都看到以下的情况:TortiseSVN要求输入密码:

Sep 26 17:34:31 dev sshd[30361]: Accepted password for USER from xx.xxx.xx.xxx port 59101 ssh2
Sep 26 17:34:31 dev sshd[30361]: pam_unix(sshd:session): session opened for user USER by (uid=0)
Sep 26 17:34:31 dev sshd[30361]: pam_unix(sshd:session): session closed for user USER

I'm actually able to login, but the session is then closed immediately.

我实际上能够登录,但会话会立即关闭。

It caught my eye that the session is being opened for USER by root (uid=0), which may be correct, but I'll mention it in case it has something to do with the problem.

我注意到,这个会话是由root (uid=0)为用户打开的,这可能是正确的,但是我将提到它,以防它与这个问题有关。

I looked into modifying the svnserve.conf, but as far as I can tell, it's not used when accessing the repository via svn+ssh, a private svnserve instance is created for each log in via this method. From the manual:

我查看了修改svnserve。conf,但是据我所知,在通过svn+ssh访问存储库时不使用它,通过这种方法为每个日志创建一个私有的svnserve实例。从手册:

There's still a third way to invoke svnserve, and that's in “tunnel mode”, with the -t option. This mode assumes that a remote-service program such as RSH or SSH has successfully authenticated a user and is now invoking a private svnserve process as that user. The svnserve program behaves normally (communicating via stdin and stdout), and assumes that the traffic is being automatically redirected over some sort of tunnel back to the client. When svnserve is invoked by a tunnel agent like this, be sure that the authenticated user has full read and write access to the repository database files. (See Servers and Permissions: A Word of Warning.) It's essentially the same as a local user accessing the repository via file:/// URLs.

还有第三种调用svnserve的方法,那就是在“隧道模式”中使用-t选项。此模式假定远程服务程序(如RSH或SSH)已经成功地验证了一个用户,并且现在调用了一个私有的svnserve进程作为该用户。svnserve程序的行为通常(通过stdin和stdout进行通信),并假定流量会自动地重新定向到客户端的某种通道上。当像这样的隧道代理调用svnserve时,请确保经过身份验证的用户已经对存储库数据库文件进行了完整的读写访问。(请参阅服务器和权限:一个警告字。)它基本上与本地用户通过file:// url访问存储库相同。

The only non-default settings in sshd_config are:

sshd_config中唯一的非默认设置是:

Protocol 2 # to disable Protocol 1

SyslogFacility AUTHPRIV

ChallengeResponseAuthentication no

GSSAPIAuthentication yes
GSSAPICleanupCredentials yes

UsePAM yes

AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv XMODIFIERS

X11Forwarding no

Subsystem       sftp    /usr/libexec/openssh/sftp-server

Any thoughts?

任何想法吗?

3 个解决方案

#1


4  

I finally came across a solution for this. In the TortoiseSVN FAQ of all places:
TortoiseSVN Frequently asked questions

我终于找到了解决这个问题的办法。在所有地方的玳瑁常见问题:龟甲的常见问题。

From the FAQ:
SVN+SSH: Connection closed unexpectedly

从FAQ: SVN+SSH:连接意外关闭。

It has been reported that svn+ssh connections of the form svn+ssh://username@server.com which were previously working, stop working with TortoiseSVN 1.5. This seems to be related to plink, and occurs if you have a default hostname set in PuTTY.

据报道,svn+ssh连接的形式是svn+ssh://username@server.com,它以前是工作的,现在停止使用象甲1。5。这似乎与plink有关,如果您在PuTTY中设置了默认的主机名,就会发生这种情况。

If this is the case you can fix it by using regedit or regedt32 to clear HKEY_CURRENT_USER/Software/SimonTatham/Putty/Sessions/Default%20Settings/HostName.

如果是这样,您可以使用regedit或regedt32来清除HKEY_CURRENT_USER/软件/SimonTatham/Putty/Sessions/默认的%20设置/主机名。


Another user has reported the following server-side fix:

另一个用户报告了以下服务器端修复:

  • ssh into your account
  • ssh到你的账户
  • cd ~
  • cd ~
  • cp /etc/bashrc .bashrc
  • cp /etc/bashrc . bashrc
  • nano .bashrc
  • nano . bashrc
  • put a # before the line "mesg y" (which comments it out)
  • 在“mesg y”之前加一个#(注释掉了)
  • Ctrl+X to exit, press Y when prompted to save.
  • 按Ctrl+X键退出,提示保存时按Y。

I didn't try the first approach of editing my registry.

我没有尝试编辑注册表的第一种方法。

The second approach of editing the bash configuration worked for me.

编辑bash配置的第二种方法对我有效。

A note about the bash configuration method:

关于bash配置方法的说明:

If you're on shared hosting, your user .bashrc file will likely be loading the global /etc/bashrc file. You won't be able to edit the global file, so you'll need to work around that.

如果您在共享主机上,您的用户.bashrc文件可能会装载全局/etc/bashrc文件。您将无法编辑全局文件,因此您需要解决这个问题。

Some possible approaches:

一些可能的方法:

  • Try adding mesg n to your user .bashrc file. I'm not sure if this will work or whether it should be placed before or after the global file is loaded.

    尝试将mesg n添加到用户.bashrc文件中。我不确定这是否可行,或者是否应该在加载全局文件之前或之后放置。

  • Don't include the global file and hard code all the settings in your user .bashrc file.

    不要将全局文件和硬代码包含在用户.bashrc文件的所有设置中。

  • Remove the mesg y setting from the global /etc/bashrc file as it's loading. This question discusses how to do that: Use a grepped file as an included source in bash

    在加载时从全局/etc/bashrc文件中删除mesg y设置。这个问题讨论了如何做到这一点:在bash中使用一个包含源代码的文件。

#2


2  

An old question, but still top of the stack on Google, so I thought I'd share my solution.

一个老问题,但仍然是谷歌上的栈顶,所以我想分享我的解决方案。

Simply, it was because I didn't have a "home" directory for my user on the server. Changing the SSH client to the plink.exe that comes with Putty (right-click on folder | TortoiseSVN | Settings | Network) allowed me to see the error as the windows appeared on screen.

简单地说,这是因为我在服务器上没有一个“home”目录。将SSH客户机更改为plink。当windows出现在屏幕上时,使用Putty(右键单击文件夹|和|设置|网络)的exe允许我看到错误。

#3


0  

In my case the cause was, that the svnuser hasn't a shell (it was /bin/false).
This isn't visible in the ssh log even with debug ssh -vvv.

在我的例子中,原因是,svnuser没有shell(它是/bin/false)。这在ssh日志中是不可见的,即使是调试ssh -vvv。

When you have this type of problem your debug output will look like this

当您遇到这种类型的问题时,您的调试输出将是这样的。

debug1: Entering interactive session.
debug1: Remote: Forced command.
debug1: Remote: Port forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Remote: Forced command.
debug1: Remote: Port forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Sending environment.
debug1: Sending env LANG = en_GB.UTF-8
debug1: Sending command: svnserve -t
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
debug1: channel 0: free: client-session, nchannels 1

When the shell is set to /bin/bash the log changes to

当shell被设置为/bin/bash时,日志将更改为。

debug1: Sending env LANG = en_GB.UTF-8
debug1: Sending command: svnserve -t
Path: MyRepo
URL: svn+ssh://svnuser@myServer.com/MyRepo

#1


4  

I finally came across a solution for this. In the TortoiseSVN FAQ of all places:
TortoiseSVN Frequently asked questions

我终于找到了解决这个问题的办法。在所有地方的玳瑁常见问题:龟甲的常见问题。

From the FAQ:
SVN+SSH: Connection closed unexpectedly

从FAQ: SVN+SSH:连接意外关闭。

It has been reported that svn+ssh connections of the form svn+ssh://username@server.com which were previously working, stop working with TortoiseSVN 1.5. This seems to be related to plink, and occurs if you have a default hostname set in PuTTY.

据报道,svn+ssh连接的形式是svn+ssh://username@server.com,它以前是工作的,现在停止使用象甲1。5。这似乎与plink有关,如果您在PuTTY中设置了默认的主机名,就会发生这种情况。

If this is the case you can fix it by using regedit or regedt32 to clear HKEY_CURRENT_USER/Software/SimonTatham/Putty/Sessions/Default%20Settings/HostName.

如果是这样,您可以使用regedit或regedt32来清除HKEY_CURRENT_USER/软件/SimonTatham/Putty/Sessions/默认的%20设置/主机名。


Another user has reported the following server-side fix:

另一个用户报告了以下服务器端修复:

  • ssh into your account
  • ssh到你的账户
  • cd ~
  • cd ~
  • cp /etc/bashrc .bashrc
  • cp /etc/bashrc . bashrc
  • nano .bashrc
  • nano . bashrc
  • put a # before the line "mesg y" (which comments it out)
  • 在“mesg y”之前加一个#(注释掉了)
  • Ctrl+X to exit, press Y when prompted to save.
  • 按Ctrl+X键退出,提示保存时按Y。

I didn't try the first approach of editing my registry.

我没有尝试编辑注册表的第一种方法。

The second approach of editing the bash configuration worked for me.

编辑bash配置的第二种方法对我有效。

A note about the bash configuration method:

关于bash配置方法的说明:

If you're on shared hosting, your user .bashrc file will likely be loading the global /etc/bashrc file. You won't be able to edit the global file, so you'll need to work around that.

如果您在共享主机上,您的用户.bashrc文件可能会装载全局/etc/bashrc文件。您将无法编辑全局文件,因此您需要解决这个问题。

Some possible approaches:

一些可能的方法:

  • Try adding mesg n to your user .bashrc file. I'm not sure if this will work or whether it should be placed before or after the global file is loaded.

    尝试将mesg n添加到用户.bashrc文件中。我不确定这是否可行,或者是否应该在加载全局文件之前或之后放置。

  • Don't include the global file and hard code all the settings in your user .bashrc file.

    不要将全局文件和硬代码包含在用户.bashrc文件的所有设置中。

  • Remove the mesg y setting from the global /etc/bashrc file as it's loading. This question discusses how to do that: Use a grepped file as an included source in bash

    在加载时从全局/etc/bashrc文件中删除mesg y设置。这个问题讨论了如何做到这一点:在bash中使用一个包含源代码的文件。

#2


2  

An old question, but still top of the stack on Google, so I thought I'd share my solution.

一个老问题,但仍然是谷歌上的栈顶,所以我想分享我的解决方案。

Simply, it was because I didn't have a "home" directory for my user on the server. Changing the SSH client to the plink.exe that comes with Putty (right-click on folder | TortoiseSVN | Settings | Network) allowed me to see the error as the windows appeared on screen.

简单地说,这是因为我在服务器上没有一个“home”目录。将SSH客户机更改为plink。当windows出现在屏幕上时,使用Putty(右键单击文件夹|和|设置|网络)的exe允许我看到错误。

#3


0  

In my case the cause was, that the svnuser hasn't a shell (it was /bin/false).
This isn't visible in the ssh log even with debug ssh -vvv.

在我的例子中,原因是,svnuser没有shell(它是/bin/false)。这在ssh日志中是不可见的,即使是调试ssh -vvv。

When you have this type of problem your debug output will look like this

当您遇到这种类型的问题时,您的调试输出将是这样的。

debug1: Entering interactive session.
debug1: Remote: Forced command.
debug1: Remote: Port forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Remote: Forced command.
debug1: Remote: Port forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Sending environment.
debug1: Sending env LANG = en_GB.UTF-8
debug1: Sending command: svnserve -t
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
debug1: channel 0: free: client-session, nchannels 1

When the shell is set to /bin/bash the log changes to

当shell被设置为/bin/bash时,日志将更改为。

debug1: Sending env LANG = en_GB.UTF-8
debug1: Sending command: svnserve -t
Path: MyRepo
URL: svn+ssh://svnuser@myServer.com/MyRepo