Linux 基于 HTTP 代理的 svn

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

svn over HTTP proxy

linuxsvnubuntuproxy

提问by small_jam

I'm on laptop (Ubuntu) with a network that use HTTP proxy (only http connections allowed).
When I use svn up for url like 'http://.....' everything is cool (google chrome repository works perfect), but right now I need to svn up from server with 'svn://....' and I see connection refused.
I've set proxy configuration in /etc/subversion/servers but it doesn't help.
Anyone have opinion/solution?

我在笔记本电脑(Ubuntu)上使用 HTTP 代理(仅允许 http 连接)的网络。
当我将 svn up 用于 'http://.....' 之类的 url 时,一切都很酷(谷歌浏览器存储库工作正常),但现在我需要从服务器使用 'svn://.... ' 然后我看到连接被拒绝。
我已经在 /etc/subversion/servers 中设置了代理配置,但它没有帮助。
有人有意见/解决方案吗?

采纳答案by cubex

In /etc/subversion/serversyou are setting http-proxy-host, which has nothing to do with svn://which connects to a different server usually running on port 3690 started by svnservecommand.

/etc/subversion/servers您设置中http-proxy-host,这与svn://连接到通常在端口 3690 上由svnserve命令启动的不同服务器 无关。

If you have access to the server, you can setup svn+ssh://as explained here.

如果您有权访问服务器,则可以svn+ssh://按照此处的说明进行设置

Update: You could also try using connect-tunnel, which uses your HTTPS proxy server to tunnel connections:

更新:您也可以尝试使用connect-tunnel,它使用您的 HTTPS 代理服务器建立隧道连接:

connect-tunnel -P proxy.company.com:8080 -T 10234:svn.example.com:3690

Then you would use

然后你会使用

svn checkout svn://localhost:10234/path/to/trunk

回答by Cetra

when you use the svn:// URI it uses port 3690 and probably won't use http proxy

当您使用 svn:// URI 时,它使用端口 3690,并且可能不会使用 http 代理

回答by Olaf Kock

svn:// doesn't talk http, therefor there's nothing a http proxy could do.

svn:// 不使用 http,因此 http 代理无能为力。

Any reason why http doesn't work? Have you considered https? If you really need it, you probably have to have port 3690 opened in your firewall.

http 不起作用的任何原因?你考虑过https吗?如果你真的需要它,你可能必须在你的防火墙中打开端口 3690。

回答by Kent Fredric

If you can get SSH to it you can an SSH Port-forwarded SVN server.

如果您可以通过 SSH 访问它,您就可以使用 SSH 端口转发的 SVN 服务器。

Use SSHs -L( or -R, I forget, it always confuses me ) to make an ssh tunnel so that

使用SSHs -L(或者-R,我忘记了,它总是让我感到困惑)创建一个 ssh 隧道,以便

127.0.0.1:3690is really connecting to remote:3690 over the ssh tunnel, and then you can use it via

127.0.0.1:3690实际上是通过 ssh 隧道连接到 remote:3690,然后您可以通过以下方式使用它

svn co svn://127.0.0.1/....

回答by massimogentilini

If you're using the standard SVN installation the svn:// connection will work on tcpip port 3690 and so it's basically impossible to connect unless you change your network configuration (you said only Http traffic is allowed) or you install the http module and Apache on the server hosting your SVN server.

如果您使用标准 SVN 安装,则 svn:// 连接将在 tcpip 端口 3690 上工作,因此除非您更改网络配置(您说只允许 Http 流量)或安装 http 模块和Apache 在托管您的 SVN 服务器的服务器上。

回答by gadgetweb.de

Okay, this topic is somewhat outdated, but as I found it on google and have a solution this might be interesting for someone:

好的,这个话题有点过时了,但是当我在谷歌上找到它并有一个解决方案时,这对某人来说可能很有趣:

Basically (of course) this is not possible on every http proxy but works on proxies allowing http connect on port 3690. This method is used by http proxies on port 443 to provide a way for secure https connections. If your administrator configures the proxy to open port 3690 for http connect you can setup your local machine to establish a tunnel through the proxy.

基本上(当然)这在每个 http 代理上都是不可能的,但在允许 http 连接端口 3690 的代理上工作。端口 443 上的 http 代理使用此方法来提供一种安全 https 连接的方法。如果您的管理员将代理配置为为 http 连接打开端口 3690,您可以设置本地计算机以通过代理建立隧道。

I just was in the need to check out some files from svn.openwrt.org within our companies network. An easy solution to create a tunnel is adding the following line to your /etc/hosts

我只是需要从我们公司网络内的 svn.openwrt.org 中查看一些文件。创建隧道的一个简单解决方案是将以下行添加到您的 /etc/hosts

127.0.0.1 svn.openwrt.org

127.0.0.1 svn.openwrt.org

Afterwards, you can use socat to create a tcp tunnel to a local port:

之后,您可以使用 socat 创建到本地端口的 tcp 隧道:

while true; do socat tcp-listen:3690 proxy:proxy.at.your.company:svn.openwrt.org:3690; done

虽然是真的;做 socat tcp-listen:3690 proxy:proxy.at.your.company:svn.openwrt.org:3690; 完毕

You should execute the command as root. It opens the local port 3690 and on connection creates a tunnel to svn.openwrt.org on the same port.

您应该以 root 身份执行该命令。它打开本地端口 3690 并在连接时在同一端口上创建到 svn.openwrt.org 的隧道。

Just replace the port and server addresses on your own needs.

只需根据自己的需要替换端口和服务器地址。

回答by dillera

Ok, this should be really easy:

好的,这应该很简单:

$ sudo vi /etc/subversion/servers

Edit the file:

编辑文件:

[Global]
http-proxy-host=my.proxy.com
http-proxy-port=3128

Save it, run svnagain and it will work.

保存它,svn再次运行,它将起作用。