Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I prevent checkout of certain directories in SVN?

Tags:

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 needlessly downloads many, many gigabytes of files, and usually causes all kinds of problems.

like image 473
Avi Avatar asked Nov 18 '10 10:11

Avi


People also ask

What is the difference between svn checkout and export?

svn export simply extracts all the files from a revision and does not allow revision control on it. It also does not litter each directory with . svn directories. svn checkout allows you to use version control in the directory made, e.g. your standard commands such as svn update and svn commit .


2 Answers

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.

like image 122
Sander Rijken Avatar answered Sep 28 '22 12:09

Sander Rijken


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.

like image 30
Martin Schapendonk Avatar answered Sep 28 '22 11:09

Martin Schapendonk