How can I prevent checkout of certain directories in SVN?
I have a directory structure in my SVN repository which is pretty standard:
/project1
/trunk
/branches
/branch1
/branch2
...
/tags
/project2
/trunk
/branches
...
I'm using Apache with mod_dav_svn to host the repository.
I would like to prevent people from accidentally checking out the root of a project or the root of the entire repository, which needlessl开发者_运维百科y downloads many, many gigabytes of files, and usually causes all kinds of problems.
You can use mod_dontdothat
for this. See the docs:
Specifically, it's designed to keep users from doing things that are particularly hard on the server, like checking out the root of the tree, or the tags or branches directories. It works by sticking an input filter in front of all REPORT requests and looking for dangerous types of requests. If it finds any, it returns a 403 Forbidden error.
Check out the section in the SVN book about Path-Based Authorization.
You could deny access to the root by default and allow read(write) access to the individual projects.
精彩评论