99

I want to check code from the repository http://code.sixapart.com/svn/perlbal/ . I can only access the the repository url by setting a proxy. I guess if I want to get the code from the same URL by svn I need to configure a proxy, too. So does anyone of you could tell me how to configure a HTTP proxy in svn?

By the way, I use the command-line svn client under Linux.

Beryllium
  • 12,808
  • 10
  • 56
  • 86
Haiyuan Zhang
  • 40,802
  • 41
  • 107
  • 134

6 Answers6

132

Have you seen the FAQ entry What if I'm behind a proxy??

... edit your "servers" configuration file to indicate which proxy to use. The files location depends on your operating system. On Linux or Unix it is located in the directory "~/.subversion". On Windows it is in "%APPDATA%\Subversion". (Try "echo %APPDATA%", note this is a hidden directory.)

For me this involved uncommenting and setting the following lines:

#http-proxy-host=my.proxy
#http-proxy-port=80
#http-proxy-username=[username]
#http-proxy-password=[password]

On command line : nano ~/.subversion/servers

M. Hamza Rajput
  • 7,810
  • 2
  • 41
  • 36
Rich Seller
  • 83,208
  • 23
  • 172
  • 177
  • Does anyone know if there's a way to configure it to *try* the proxy, and fall back on using the basic network connection if the proxy isn't available? I have a proxy at work, but when I'm remote I'd like to be able to use SVN without having to open up the config file and comment out the lines for the proxy. – Erik Mitchell Apr 19 '12 at 15:36
  • 1
    For me, Kimvais solution below helped. I had to uncomment the section right below '[global]'. Initially, I had uncommented the same lines at their first occurence which did not help. – Devesh Nov 20 '13 at 10:43
  • @ErikMitchell: Create two versions of the config file and scripts which allow you to switch. Read your OSs docs how to hook into the network discovery mechanism and execute the correct script when your laptop notices where it is. – Aaron Digulla Oct 01 '14 at 15:36
  • 2
    It works for me, but the password stay stored as plain text. I don't want my password expose like this. Is there a way to contour this? – Pmt Nov 17 '14 at 18:28
65

You can find the instructions here. Basically you just add

[global]
http-proxy-host = ip.add.re.ss
http-proxy-port = 3128
http-proxy-compression = no

to your ~/.subversion/servers file.

serv-inc
  • 35,772
  • 9
  • 166
  • 188
Kimvais
  • 38,306
  • 16
  • 108
  • 142
  • 7
    This is client side configuration. The 'servers' file means settings to connect to servers. See http://svnbook.red-bean.com/en/1.1/ch07.html#svn-ch-7-sect-1.3.1 – Kimvais Sep 30 '09 at 07:16
  • latest svnbook link (v1.7) for "servers" file configuration: http://svnbook.red-bean.com/en/1.7/svn.advanced.confarea.html#svn.advanced.confarea.opts – michael Nov 20 '13 at 21:04
12

In windows 7, you may have to edit this file

C:\Users\<UserName>\AppData\Roaming\Subversion\servers

[global]
http-proxy-host = ip.add.re.ss
http-proxy-port = 3128
sdafjhjh
  • 121
  • 1
  • 2
11

There are two common approaches for this:

If you are on Windows, you can also write http-proxy- options to Windows Registry. It's pretty handy if you need to apply proxy settings in Active Directory environment via Group Policy Objects.

bahrep
  • 29,961
  • 12
  • 103
  • 150
  • 1
    In linux you can use `alias svn-my-proxy='svn --config-option ...'` to be able to use `svn-my-proxy co http://svn/repo/trunk`. This allows you to easily switch between proxy (`svn-my-proxy co`) and no-proxy (`svn co`) configurations depending on what network your machine is on at the time. You can add the `alias` command to your `~/.bashrc` to be recreated on next bash login. Helps me a lot between my work network and my home network! – Drew Anderson Jul 02 '15 at 10:11
-1

In TortoiseSVN you can configure the proxy server under Settings=> Network

-2

Most *nixen understand the environment variable 'http_proxy' when performing web requests.

export http_proxy=http://my-proxy-server.com:8080/
svn co http://code.sixapart.com/svn/perlball/

should do the trick. Most http libraries check for this (and other) environment variables.

Anya Shenanigans
  • 91,618
  • 3
  • 107
  • 122
  • 27
    Sadly, Subversion does not honor http_proxy yet, and probably never will. See the issue at http://subversion.tigris.org/issues/show_bug.cgi?id=1327 – Stefan Lasiewski Apr 04 '11 at 23:15
  • 3
    Thanks for the heads up. I'm curious: under Ubuntu 14.10 the `http_proxy` convention seems to work (SVN v1.8.10). But it doesn't under Centos 6.6 (SVN v1.6.11). I searched in [their changelog](http://svn.apache.org/repos/asf/subversion/trunk/CHANGES) but didn't find anything clear enough. Any idea if it's been patched for good ? – Anto Jan 19 '15 at 17:51
  • 3
    svn 1.8 changed how http networking operates almost completely. Adding support for http_proxy may have been a side effect. – Anya Shenanigans Jan 19 '15 at 19:31