Per Project User Access in Subversion - apache

I have repositories created in C:\Data\Subversion as well as sub-folders like C:\Data\Subversion\Dev-Mobile.
I can give per project access to users for the repos in the root folder without problems. For that I'm adding those lines in svn-acl:
[Project1:/]
Test = rw
However, I try to give access for a repo in a sub-folder but it doesn't work:
[Test161:/Dev-Mobile]
Test = rw
The project is declared in subversion.conf as:
<Location /Dev-Mobile/Test161>
DAV svn
SVNPath C:/Data/Subversion/Dev-Mobile/Test161
AuthType Basic
AuthName "Test161 Repository"
AuthUserFile c:/Data/Subversion/svn-auth-file
Require valid-user
AuthzSVNAccessFile c:/Data/Subversion/svn-acl
</Location>
What am I doing wrong?

I'm not an expert on the syntax of the svn-acl file. But I think that the syntax
[Test161:/Dev-Mobile]
Test = rw
is meant for configuring the permissions of the sub-folder /Dev-Mobile of an existing repository Test161. That is, it seems you are getting the identification of the repository and the folder within the repository confused.

The problem was that I tried to add the subfolder in the path (after :/) since this was the logical thing to do but I've found out Subversion will automatically scan the subdirs.
So this is the correct sintex no matter if the repo is in the root or a subfolder!
[Test161:/]
Test = rw

Related

Enable read permission to parent directory in Subversion

I'm having trouble setting up my Subversion.
I'm currently able to access repository directories within the parent directory. i.e http://server.com/svn/project but I receive a Forbidden error if I try to access the parent directory directly http://server.com/svn/
Ideally, I would like to be able to see all my repositories from a single url so I'm trying to get this configured properly.
I have looked at /etc/apache2/conf.d/subversion.conf and I have set
<Location /svn>
DAV svn
SVNParentPath /usr/local/svn
SVNListParentPath on
AuthType Basic
AuthName "My SVN"
AuthUserFile /etc/apache2/conf/user_authentication.conf
AuthzSVNAccessFile /etc/apache2/conf/svn_authorization.conf
<LimitExcept GET PROPFIND OPTIONS REPORT>
Require valid-user
</LimitExcept>
</Location>
In /etc/apache2/conf/svn_authorization.conf I have configured
[/]
* = r
[project:/]
user1 = rw
etc..
I'm not quite sure why I am getting forbidden on parent since I believe I have read enabled for all users. I have even tried removing the * = r and putting myUsername = r but still forbidden.
What am I doing wrong?
Subversion won't show you the parent path directly. So "out of the box" you can't get the list of repositories this way. When using the web browser to access your repository, you should use viewvc, because that has many advantages to directly pointing the browser at the repository location (i.e. you can browse the history that way). If you're using a bundled SVN installation such as CollabNet, viewvc is automatically configured for your server, too.

SmartSVN Repository moved permanently

I recently set up an svn repo with authentication.
Our PC users are using tortoise SVN and are able to checkout, commit, etc.
Our Mac OS users are using SmartSVN and when trying to checkout they get the following error:
Repository moved permanently; please relocate OPTIONS
request failed on'/'
I ran into this issue when setting it up initially with tortoisesvn and the solution was making sure that that svn repo wasn't a child of the www directory. So I placed it in the home directory
The home directory looks like the following:
/public_html
/repos
/www
The vhost conf file looks like:
<IfModule mod_dav_svn.c>
<Location /repos/>
DAV svn
SVNParentPath /data/svn/repos/
SVNListParentPath On
AuthType Basic
AuthName "SVN Repository"
AuthUserFile /data/svn/.htpasswds/.svn.htpasswd
AuthzSVNAccessFile /data/svn/.htpasswds/.svn.authz
Require valid-user
</Location>
</IfModule>
Both PC and Mac users are able to view the repositories with the proper authentication in a browser. The only issue is when trying to checkout when using SmartSVN on MacOS.
There aren't any errors in the log that I can see that relate.
Edit: Clarification
All users are checking out the repos with a url format like:
http://svn.myserver.com/repos/REPONAME
Both PC and Mac users are able to view the repositories with the proper authentication in a browser
Browser in your case is not the best testing-tool. CLI-based SVN-client will give more details about problem
In your case Mac-users (I suppose) tried to read repository root, not repository (it's possible in browser only with SVNListParentPath On in config, as you have). Any SVN client on any OS (for current stable 1.7) can not read SVNParentPath (promised to be changed in 1.8) and must to use
svn ls SERVER/repos/REPONAME as minimal root-level for single repository
Originally our svn was using a single repository and we changed it to use a collection of repositories. We were still using the same subdomain "svn.server.com" with the main difference that our collection is now svn.server.com/repos/
SmartSVN stored the old url "svn.server.com" and seemed to ignore the new supplied url during checkout (svn.server.com/repos/TEST)
The solution is simple.
SmartSVN > Preferences > Authentication
Delete the old record and then try to check out again.

Tortoise SVN Redirect Cycle [CENTOS 5.8 / WHM]

Hoping somebody can shed some guru-knowledge here as we've been racking our brains trying to figure out what is causing this error.
We're running WHM/CPanel on CENTOS 5.8
We have a sub-domain specifically set up to server as an svn repository.
We've created the VirtualHost directory and config file. The config file looks like the following:
<IfModule mod_dav_svn.c>
<Location />
DAV svn
SVNParentPath /home/<username>/public_html/svn
SVNListParentPath On
AuthType Basic
AuthName "SVN Repo"
AuthUserFile /home/<username>/.svn.htpasswd
Require valid-user
</Location>
</IfModule>
We're using SVNParentPath because we will have multiple repositories.
Our repo's are created using svnadmin create
They show up fine when we navigate to them in a browser. We can see the top level folders. When we click into them all we see is the revision number. I'm pretty sure this is normal.
In Tortoise we connect to the repo like: http://svn.ourserver.com/reponame
We've been through any and every forum post we can think of and just cannot get passed the redirect cycle. Any knowledge will be greatly appreciated.
edit
I should add that we are getting the authentication windows so I believe that that part is setup correctly.
As it turns out I think this was more of a misunderstanding of how svn is setup and how tortoiseSVN needs to access it. Tortoise can't check out multiple projects (which we knew.) What we overlooked is that creating a repository, isn't the same as creating a project.
Once we converted the svn.mydomain.com to be a repo itself, created a project within that, we were able to check it out without error.
I want to thank everyone that tried to help. I really appreciate your time.
Repo location in site-root may have big bad impact later (if you'll have not-dav parts of site under ROOT)
SVNParentPath /home/<username>/public_html/svn/ (trailing slash) will be better, can't recall why

How do I find the SVN repository URL?

I am a bit confuses finding the SVN URL to check out a copy on my computer.
The way I get to my website is: http://dev.website.com/
I have set up SVN here: /home/svn/trunk
And I checkout a copy here: /var/www/trunk
Sso http://dev.website.com/ points to /var/www/trunk.
But I need to checkout a copy of the trunk on my computer. And I try to go to http://dev.website.com/ or http://svn.dev.website.com/, but it doesn't work.
What is the URL that gets me the files from the trunk? Where do I need to set that link up?
You must not "guess and try", but find the location of your repository in file httpd.conf.
In order to do it, read the Apache configuration, and find the DAV svn string in it. Location container, which has this string, location parameter will have the path, used as repository path in case of a single repository or base-path for multi-repository.
Example
For host http://mayorat.ursinecorner.ru:8088 with configuration (part of)
<Location /svn/>
DAV svn
SVNListParentPath on
SVNParentPath physical-path
path to any repository, created under SVNParentPath directory, will be
mayorat.ursinecorner.ru:8088/svn/Repo-dir-name/

SVN branches and virtual hosts

I come from a GIT background and now have to work using SVN.
Usually, when working with GIT, I had Apache virtual host set up to one folder as document root and when I wanted to switch branches I just did git checkout branch.
From what I see with SVN now, when I make branches I have to make a new folder for each branch. Is that true or is there some other way to accomplish to what I'm used to with GIT?
Because, that would mean I have to make a number of different virtual hosts or use wildcard dns or something.
Thanx.
You could use svn switch to switch your working copy to a different branch, if you want to keep it in the same directory.
In Subversion branching is just copying a tree so yes, you would be creating a new folder. Have a look at the SVN book for their chapter on branching/merging: http://svnbook.red-bean.com/nightly/en/svn.branchmerge.html
There's no natural mapping between virtual hosts and version control systems like Subversion or git so I'm afraid I can't comment on how it might relate to your different vHosts. Maybe you could talk about your setup a little more.
If you are having something like:
<VirtualHost [server's IP address]:443>
ServerName svn.example.com
<Location />
DAV svn
AuthType Basic
AuthName "svn.example.com"
AuthUserFile /var/local/svn/svn.example.com/conf/passwd
AuthzSVNAccessFile /var/local/svn/svn.example.com/conf/authz
SVNPath /var/local/svn/svn.example.com
Require valid-user
</Location>
</VirtualHost>
you don't have to worry about handling different branches explicitly.
A way to accomplish what you are used to with git is to use git-svn.