问题
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?
回答1:
Why not just configure anon-access = read and auth-access = read in svnserve.conf?
回答2:
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.
来源:https://stackoverflow.com/questions/9228183/subversion-is-it-possible-to-disable-all-commits-and-make-the-repository-read