Which protocol? svn:// or http(s)://?

Viewed 72719

There are four common protocols for network access of SVN.

svn://repos
svn+ssh://repos
https://repos
http://repos

The Wikipedia page doesn't say much about the differences of the four different protocols. I've always preferred svn://, because it is the easiest to set up, but what is the difference and which one is "better"?

6 Answers

http:// has a serious overhead, especially when dealing with thousands of small files. I used svn for a website that had around 50,000 icons, all saved in SVN. With HTTP, it took around 20 minutes to checkout. Once I switched to svn://, it took less than a minute. This is because with HTTP it's one new HTTP request per file.

http:// however has the following big advantage: it usually goes through firewalls. For example, now that I switched to svn:// I can no longer access my repository from my university because of their firewall.

Regarding the difference between using SSL/TLS or not, well, it's obvious: data is encrypted; however it's more difficult to set up.

svn+ssh is the svn protocol run inside a SSH tunnel. The client uses SSH to log on the remote server and remotely runs the svn command in that tunnel. In my view, svn+ssh is the easiest way to use a subversion repository on a distant system, because you do not have any server to launch on that system, assuming that you already have a SSH server running.

Also, svn+ssh benefits from the cryptographic protection of SSH. Do not use raw svn protocol over untrusted networks.

The main problem with svn+ssh is that it requires shell access on the remote machine. It is difficult to offer someone access to the repository without giving him access to the whole shell account. For that, you want one of the HTTP-based methods, i.e. http or https (preferably https because of the encryption-and-authentication layer). These methods are more complex to configure (you need a HTTP/HTTPS server, e.g. Apache) but allow the repository administrator to carefully and precisely control repository access rights.

https:// and svn+ssh:// are encrypted and so are safer for transmitting secure data (such as your SVN password.

If it's anything like Git, svn+ssh:// will be faster than https:// and svn:// will be faster than http://.

http and https are handled by web server module for Subversion support, so you can use HTTP-based authentication (configured through .htaccess) to limit access to your repository).

Related