How To: Manage Your Own Subversion Repository In Leopard

17 11 2007

Some of us linux users use both Linux and Apple. Because I deal with both Linux, Mac and Microsoft OS’s in my networks, I like to keep configuration files and source code for my custom apps in SubVersion. I came across a great article for MAC OS X Leopard SVN setup.

Mac OS X 10.5 Leopard ships with Subversion 1.4.4 pre-installed. It also ships with Apache2 pre-installed. It does not, however, ship with a pre-installed subversion repository configuration.

So let’s say you want to create your own subversion repository host on your Leopard box your own source code management goodness?

You could go to the subversion homepage and download the free svn book and sort through the instructions trying to figure out how they apply to you… Or you could follow these simple directions which I’ve laid out for you.

Make a Repository

The first thing you need to do is to make a repository. Actually, for my needs, I had to make multiple repositories, so these instructions will set everything up to make that work. It really only changes two steps anyway, so it isn’t a big deal.

Now I decided to make my repository collection root directory be in /Users/Shared/, but you can really make it be anything you want, including the ever popular /usr/local. Just be sure to replace /Users/Shared/ with your directory of choice whenever necessary.

Anyway, I opened Terminal and entered the following commands:

$ sudo mkdir /Users/Shared/svn
$ sudo mkdir /Users/Shared/svn/reposname
$ sudo svnadmin create /Users/Shared/svn/reposname
$ sudo chown -R www:www reposname

Note that you can create multiple repositories by following these directions but replacing every instance of reposname with the name of the repository you want to use. Thus, if you have multiple repositories, you will have multiple directoris in /Users/Shared/svn

Make Access

Most directions do this later, but I’m going to do it now because I think you are smarter than that.

You might want to create a passowrd file, unless you want full public access to your repository. For our purposes, simple http basic authentication is fine, but remember that the password is only weakly encoded and the traffic isn’t encoded at all, so a snooper could get to the information if you access your computer outside of your own computer.

So if you do want to use authentication, create the password using the following command, substituting username for a user name of your choice, and following the directions for password creation:

$ sudo htpasswd -cm /etc/apache2/svn-auth-file username

To add other users to the file, just ditch the c switch in the -cm options to htpasswd. The c stood for create, and since the file has been created you don’t want it anymore.

Note that you can put the svn-auth-file anywhere you want, but this seemed like a good place for it in my mind. (Just remember where you hid it from yourself if you put it anywhere else.

Apache Configuration

Navigate to /etc/apache2/other and use your favorite command line text editor as root to make a file named anything you want (I chose svn.conf, but you could name it foobar_banana.conf and it would still work!):

$ cd /etc/apache2/other
$ sudo vim svn.conf

Now that you are editing this file as root, you want to make it contain the following bits, and save:

LoadModule dav_svn_module /usr/libexec/apache2/mod_dav_svn.so

<Location /svn>
    DAV svn

    SVNParentPath /Users/Shared/svn

    AuthType Basic
    AuthName "Subversion repository"
    AuthUserFile /etc/apache2/svn-auth-file
    Require valid-user
</Location>

Note that you can leave off all the authentication related stuff if you didn’t want authentication on your repository. Also note that you need to fix the SVNParentPath and the AuthUserFile if you varied from my directions.

Restart Apache

Now restart Apache. This can be done in the Sharing panel of the System Preferences application. Just click to turn off, and then back on, Web Sharing.

Now, if you didn’t make a mistake, you should be ready! Try going to http://localhost/svn/reposname (where you need to put the repository name you chose earlier instead of reposname!) and see what happens.

If you are lucky you’ll see revision 0 of your repository. But most people are human and will have made a typo that results in an error. For hints on what created the error, trying checking out /var/log/system.log and /var/log/apache2/error_log for hints as to what you did wrong. (And as a bonus, the Console application works great for monitoring thes logs as they are writen to!)

Where From Here?

And now you are ready to use your repository. At this point I figure you already know how to use SVN and don’t need my help anymore. But if you need to know how to use SVN, just refer to their book, which tells you everything you need to know, including how to make your server better!

EDIT (11/6/07): Forgot to encode my character entities in the example script source. I fixed this so that the <Location> tag actually shows now.

Article By: Paploo

Advertisements

Actions

Information

22 responses

6 12 2007
Cyriel

Paploo,

Thank you for sharing this with me. After two days wrestling through subversion manuals, configuring, downloading and building subversion i knew there would be something “mackish” to solve this. No need to download anything. All is packed in Leopard. Great!

I also have Leopard 10.5(.1) as you have. But there is a difference (probably in the apache version), because i do not have the “others” directory. It is called “sites” now.

Another difference is that, nomatter what i try, the mod_dav_svn module crashes the webserver. I don’t know if mac has tested this at all, but enabling the module stops the webserver.

Can you tell me what exact apache version you are running?

Cheers,
Cyriel

29 05 2008
Brandon

Thanks for the excellent setup instructions! I was up and running in minutes. I’m using OS X 10.5.3.

24 07 2008
R.M.

I’m trying in vain to connect to our company’s svn repository from my MAC. The repository is on a windows network drive which I can navigate to via System Prefs and ‘Connect to Network’. It appears in Finder and I’m able to browse it’s contents. However, when it comes time to direct the svn app to the repository url, I have no idea how to give it a path. TortoiseSVN on my PC is happy with simply entering ‘svn://repository_directory_name’ , but none of the MAC subversion software I’ve tried will accept that as a url.
How do I direct the subversion software to the network repository?

24 07 2008
MrNovell

You could try svn co smb://repository_directory_name

Let me know if that works

24 07 2008
R.M.

Hmm . . I continue to get “Unrecognized URL scheme” errors.
I think we’re going to try getting in via command line.

Thanks for the suggestion though.

25 07 2008
R.M.

Finally got it working. The “svn://directory_name/subdirectory_name” structure worked, but I had to substitute [directory_name] with the actual IP address.

10 07 2009
Matt Deaves

Hi there, thanks for this, works lovely. Could you advise on how to setup each repo within the svn folder to use it’s own htpasswd file though? I’d like to maintain separate lists for each repo.

I’ve tried a few modifications but can’t get it quite right. If I find an answer I’ll post it back here, but in the meantime any hints would be greatly appreciated.

Thanks,

Matt

21 01 2010
mrnovell

Hello, Matt

Are you still looking for an answer?

22 11 2009
Subversion and Snow Leopard | David Orriss Jr – The Delusion That People Care About What I Think

[…] Patrick references the following article. It’s extremely educational and informative: How To: Manage Your Own Subversion Repository In Leopard. The details still apply in Snow Leopard, as […]

3 02 2010
Woozle man

I think you should mention that the file /etc/apache2/other/svn.conf needs to be referenced in httpd.conf, perhaps at the bottom in a fashion such as:

Include “/etc/apache2/other/svn.conf”

However, as Cyriel mentioned above, if the svn.conf file resides in /etc/apache2/sites/ then it should be included, as the tailing line of the default version of httpd.conf is

Include “/etc/apache2/sites/*.conf”

Otherwise none of this will work.

3 02 2010
Woozle man

Another note. If someone is enabling SVN from scratch, the following guide is essential:

http://agileshrugged.com/blog/?p=14

It tells you how to enable WebDav, which is *not* enabled by default, which will be really annoying to find out after about an hour of trying to get apache to load the mod_dav_svn.so module :/

Hope this saves other people from a similar headache

6 03 2011
Mike

typo

$ sudo chown -R www:www reposname
$ sudo chown -R www:www /Users/Shared/svn/reposname

8 03 2013
Mozelle

Heya i am for the first time here. I found this board and I find It truly useful & it helped me out a lot.

I hope to give something back and help others like you aided
me.

25 06 2013
Doreen

Truly no matter if someone doesn’t understand afterward its up to other people that they will help, so here it takes place.

26 06 2013
Jasmin

I was curious if you ever considered changing the structure of your site?
Its very well written; I love what youve got to say.
But maybe you could a little more in the way of content so
people could connect with it better. Youve got an awful lot of text
for only having one or two images. Maybe you could space it
out better?

26 06 2013
Brian Scott

I plan on adding more content, as of now I maintain two blogs. What type of content would you like to see?

28 06 2013
toy storage

Thank you for some other magnificent article. The place else could anybody get that
kind of info in such a perfect way of writing?
I have a presentation next week, and I’m at the look for such info.

30 06 2013
ordering portable storage

Hello There. I found your weblog the usage of msn.

This is an extremely well written article. I’ll be sure to bookmark it and come back to read more of your useful information. Thank you for the post. I’ll definitely return.

1 07 2013
plastic storage bins

Fantastic beat ! I wish to apprentice even
as you amend your website, how could i subscribe for a weblog website?
The account helped me a appropriate deal. I were a little bit acquainted of
this your broadcast provided vivid transparent concept

4 08 2013
http://gpbecauseyoumatter.ning.com/profiles/blogs/what-is-brindall-berry-malabar-tamarind-or

This is my first time pay a visit at here and i am actually happy to
read all at alone place.

24 09 2014
market america

‘This week, I will only drink one beer on Friday night, saving myself thousands of calories’.
Most of them are full of sugar and processed flour.

The program is based on nutrition that helps you burn fat and keep
lean muscle, boosts your metabolism and helps control hunger.

4 07 2016
cpa network weekly

My developer is trying to persuade me to move to .net from PHP.
I have always disliked the idea because of the costs.
But he’s tryiong none the less. I’ve been using Movable-type on a variety of websites for about a year and am concerned about switching to another platform.
I have heard great things about blogengine.net.
Is there a way I can transfer all my wordpress posts
into it? Any kind of help would be really appreciated!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: