Subversion - 是否可以禁用所有提交并使存储库只读?
我有一个颠覆存储库,它是另一个远程存储库的镜像。我每周都会使用 svnsync 来镜像存储库。镜像存储库(本地副本)仅用于备份。
我想将镜像存储库保持为只读,即任何人都不能对此存储库提交任何更改,但他们可以使用它来读取源文件,因为它比远程存储库更快。
我在 Google 上浏览了一下,看起来 Hook 可能是最好的选择。唯一的问题是,我在 Google 上看到的所有示例都是基于 Unix 的,并且我无法找到适合 Windows 的示例,因为镜像存储库正在 Windows 服务器上运行。
有什么想法吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,您在结账网址中使用的是
http://
还是svn://
?如果您使用
svn://
,则可以在存储库中配置svnserve.conf
文件,只需使用空的传递文件即可删除授权访问。匿名访问默认为“只读”,因此只要您没有更改svnserve.conf
文件中的该设置,就应该没问题。或者,您可以关闭匿名访问,并将授权访问更改为只读
。但是,如果您使用
http://
,则必须在 Subversion 服务器上将 Apache httpd 配置配置为不允许写入访问。这变得更加棘手,因为设置 Apache httpd 身份验证的方法有多种,并且根据系统的不同,Apache httpd 可能存储在多个位置。
另一种可能性是使用 预提交挂钩 关闭对存储库。
顺便说一句,旧的 svnsync 命令不仅需要 svn 读写访问权限来提交正在同步的更改,而且还必须设置 pre-revprop-change 挂钩,因此 svnsync 命令还可以修改
svn:log
、svn:date
和svn:author
属性以匹配原始存储库。这意味着,如果您设法将存储库设置为只读,则可能会破坏 svnsync。您需要了解 svnsync 的工作原理以及情况是否仍然如此。我的预提交钩子也可以解决这个问题。First of all, are you using
http://
orsvn://
in your checkout URLS?If you're using
svn://
, you can configure thesvnserve.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 yoursvnserve.conf
file, you should be fine. Or, you can turn off anonymous access, and change the authorized access toread-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
, andsvn:author
properties to match the original repository. That means, if you manage to make your repository read-only, you might breaksvnsync
. You'll need to read up on howsvnsync
works and whether this is still the case. My pre-commit hook can solve that problem too.为什么不在 svnserve.conf 中配置 anon-access = read 和 auth-access = read 呢?
Why not just configure anon-access = read and auth-access = read in svnserve.conf?