Search This Blog

Wednesday, July 15, 2009

How to set up SVN

I wanted to set up an SVN server for my project recently. Here is the small script that I wrote for configuring SVN. Just copy-paste it in a file and run it. It'll guide you through the configuration process.
-------------------------------------------
#!/usr/bin/bash

svnadmin create svnrepos  #creates a directory called svnrepos 
#in the current directory, and 
#creates the config files

printf "[general]\nanon-access = none\nauth-access = write\npassword-db = passwd\n" > svnrepos/conf/svnserve.conf
printf "[users]\n" > svnrepos/conf/passwd

while [ 1 -gt 0 ]
do
    printf "Username: "      #create username,password for 
    read user                #whom access is required  
    if [ $user == "q" ]      #press "q" to stop accepting username, passwords
    then
       break
    fi
    printf "Password: "
    read pass
    printf "$user"" = ""$pass\n" >> svnrepos/conf/passwd
done

-------------------------------------------------
To start svnserver,
svnserve -r /users/proj/prashanth.kamle/svnrepos -d

/users/proj/prashanth.kamle/svnrepos is the path of the directory in which the SVN repository would reside (/users/proj/prashanth.kamle is the current directory).

To stop the SVN server, just kill the process (or use the script below)
#!/bin/bash
pid=`ps -A|grep svnserve| cut -d" " -f1`
kill $pid

In my next post, I'll explain how to access SVN from eclipse. Till then, happy subversioning :)

2 comments:

Kashyap said...

can't wait for the svn eclipse integration lecture :) I might even consider switching from git.

Prashanth Kamle said...

Coming soon :)