Enable svn proxy on TeamCity server

Problem described as this post. We need to setup a CI for an external svn repository on teamcity server sitting behind the firewall.

(NOTE: if setting proxy is too hard for you, the easiest workaround is to create a local git clone, then share this folder, say, \\tcserver\gitrepo, in teamcity VCS fetch url section, set it to this exact same sharing name, \\tcserver\gitrepo, the build will be hooked up. Obviously you don’t have the real trigger setup, you need to manually git pull to local before you trigger the build, a little bit complex, but it works.)


On CC.net we have the svn Tortoise client installed so we can easily control proxy through TortoiseSVN settings->Network, Enable Proxy Server. But TeamCity has its own svn library, SVNKit, how to configure proxy then?

According to SVNKit,

By default SVNKit uses proxy settings from the servers configuration file that is located in the default SVN run-time configuration area.

And that stackoverflow post did point out the area to look for should be:

  • C:\Users\AccountName\AppData\Roaming\Subversion\servers on Vista/7/2008 (domain account)
  • C:\Windows\ServiceProfiles\LocalService\AppData\Roaming\Subversion\servers on Vista/7/2008 (service account)
  • C:\Documents and Settings\AccountName\Application Data\Subversion\servers on XP/2003

It’s very confusing that teamcity use C:\Windows\system32\config\systemprofile\AppData\Roaming\Subversion as default config folder. For some reason this folder is set to system folder on our server, which caused a lot of trouble to us.

Switching to a regular folder, e.g., c:/tmp, even C:\Users\TCADMIN\AppData\Roaming\Subversion, when first time clicking test connection button, it will create three files in that folder: config, servers and README.

To set proxy,we just need to open servers file, change the those settings:

http-proxy-host = proxy1.some-domain-name.com
http-proxy-port = 80
http-proxy-username = blah
http-proxy-password = doubleblah

If VCS checkout mode is set to Automatically on Server, this is all we need. If VCS checkout mode is set to Automatically on Agent, watch out! The config folder will be created on agent machine, and another auto-generated servers file! We have to change this servers file again, and the proxy username is not for agent, it should be the one works on Server!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s