Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Subversion - Is it possible to disable all commits and make the repository read only?

I have a subversion repository that is a mirror of another remote repository. I use svnsync to mirror the repository every week. The mirrored repository (local copy) is only there for backup.

I would like to keep the mirrored repository as READ-ONLY, i.e. nobody should be able to commit any changes to this repository but they can use it for reading source files as it is faster than the remote repository.

I had a look around on Google and it seems that a Hook is probably the best option. The only problem is that all of the examples i am seeing on Google are Unix based and i cant find a suitable example for Windows as the mirrored repository is running on a Windows Server.

Any ideas?

like image 824
ziggy Avatar asked Feb 10 '12 12:02

ziggy


People also ask

How many responses to “read-only and read-write SVN repositories?

Posted intools 40 responses to “Read-Only and Read-Write SVN Repositories” Nic Cottrell August 27, 2008at 5:32 am| Permalink Would it be possible to have anonymous read-only access somehow?

How do I Save changes to my SVN repository?

SVN Commit – Save changes to the repository Whenever you do changes to the working copy, it will not reflect in SVN server. To make the changes permanent, you need to do SVN commit. Syntax: $ svn commit -m "log messages"

What is subversion in Linux?

Subversion is a free/open-source version control system. Subversion manages files and directories over time. A tree of files is placed into a central repository. The repository is much like an ordinary file server, except that it remembers every change ever made to your files and directories.

How to checkout a file in SVN?

SVN checkout creates the working copy, from where you can do edit, delete, or add contents. You can checkout a file, directory, trunk or whole project. To checkout you should know URL of the components you want to checkout. Syntax: $ svn checkout/co URL PATH. URL is the URL of the components to checkout


2 Answers

First of all, are you using http:// or svn:// in your checkout URLS?

If you're using svn://, you can configure the svnserve.conf file in your repository to remove authorized access by simply having an empty passed file. Anonymous access is by default 'read-only' so as long as you didn't change that setting in your svnserve.conf file, you should be fine. Or, you can turn off anonymous access, and change the authorized access to read-only.

However, if you're using http://, you have to configure your Apache httpd configuration on your Subversion server not to allow write access.

That gets trickier because there are multiple ways of setting up Apache httpd authentication, and depending upon the system, the Apache httpd could be stored in multiple locations.

Another possibility is to use a pre-commit hook to turn off all read-write access to the repository.

By the way, the old svnsync command use to require not only svn read-write access to commit changes it was syncing, but also had to have the pre-revprop-change hook set, so the svnsync command can also modify the svn:log, svn:date, and svn:author properties to match the original repository. That means, if you manage to make your repository read-only, you might break svnsync. You'll need to read up on how svnsync works and whether this is still the case. My pre-commit hook can solve that problem too.

like image 79
David W. Avatar answered Sep 24 '22 03:09

David W.


Why not just configure anon-access = read and auth-access = read in svnserve.conf?

like image 38
mac Avatar answered Sep 22 '22 03:09

mac