Home > SVN > linux: create svn repository

linux: create svn repository

Assumptions:
You already have SVN installed on your linux server. If you do not know if it is installed, just type command

which svn

If this returns a valid path as output, then it means that svn is installed on your linux box. If not, you need to install it. Installing subversion is very easy (for most distributions) and ample documentation is available on the web. You can start with http://subversion.apache.org/.

Four steps to complete svn repository creation on linux

  1. log onto server as root
  2. I prefer to have all svn repositories in one directory for better organization and easy maintenance. So next step for me would be to change to my svn directory.
    cd /svnRepos

    If you do not already have a directory for svn repositories, I would recommend creating one.

    mkdir svnRepos
  3. Create repository using following command
  4. svnadmin create /path/to/repo/RepoName

    where : RepoName is the name of repository to be created. As an example, I want to create a repository for my testproject. I would write

    svnadmin create testproject
  5. Change group ownership of repository for the intended group. In this case, consider I have a user group created as “all” and I want this group to have ownership to this repository.
    chown -R :all /path/to/repo/RepoName
  6. Grant Read/Write/Execute permissions to “all” on this repository
    chmod -R 770 /path/to/repo/RepoName

After this, all you need to do is

  • Install a client like tortoiseSVN on the user’s machine
  • SVN Checkout the repository. I would use a URL like following to connect to my newly created repository
    svn+ssh://username@servername/path/to/repo/RepoName

    Where

    • username: one of the users from group all
    • servername: my linux server which hosts SVN

    For my testproject, the path looks like

    svn+ssh://jyotsnas@servername/svnRepos/testproject

Related posts

Advertisement
Categories: SVN
  1. December 26, 2008 at 3:20 pm | #1

    Thanks a lot for this post. I always got confused earlier reading the manuals. This makes the things clear now.

  2. December 27, 2008 at 11:49 am | #2

    Nice to know it helped :)

  3. February 6, 2009 at 11:38 pm | #3

    Love the advice. Thank you.

  4. DT
    February 21, 2009 at 10:00 am | #4

    Hi, I’m new to creating svn repositories.

    We have a sizeable linux server on godaddy.com and we’re looking to create a repository there.

    Is there some special program we need on linux to type the command into to create the repository, or do we just type it into linux’ command line interface?

    • February 21, 2009 at 10:09 am | #5

      @DT

      Hi DT,

      You need subversion server (or simply called subversion/SVN) installed on your linux box. Chances are, it is already installed on your machine, and there is a simple way to find out. Just type the command ‘which svn’ in the linux command window. If you see a valid path as a result, you svn is installed. You can go ahead and create your repositories using the commands mentioned.

      If not, then you need to install it.
      Installing subversion is very easy (for most distributions) and ample documentation is available on the web. You can start with http://subversion.tigris.org.

      You will need administrative privileges to install svn as a service.

      Hope it helps :)

  5. Naveen
    March 10, 2009 at 9:11 pm | #6

    It’s Nice & crisp abt svn repository, folder creation.

    Thank You

  6. Praveen
    March 26, 2009 at 11:00 am | #7

    Hi, I’m new to creating svn repositories.
    Any way created one reading this blog. But don know how to import my project. Am using linux machine.
    I need ur help mam. Waiting for ur reply

    • March 27, 2009 at 2:28 pm | #8

      Hi Praveen

      1. to import a directory into repository

      svn import path_to_project file:///path/to/repos –message ‘Add_your_comment_like Initial repository layout’

      2. to create a new directory in your repository

      svn mkdir path_or_url_to_newdir

      Hope this helps.

      Cheers
      Jo

  7. Praveen Aithal H
    April 1, 2009 at 10:15 am | #9

    Hi Jo,
    I have one prob. Dialy morning I need to run the server with the command : SVNSERVE -d
    So, is there any other way that it wil run by itself, as soon as machin boots?

  8. PASHA
    April 23, 2011 at 12:34 pm | #11

    Hi,

    I am traing to create a SVN repository in a linux machine, which has to be access from windows. in linux using defaoult svn (subversion) and in windows using Tortoisen SVN client. ain new for SVN, how to do that.

    I gone through the your steps, and all commands working fine.

    Unable to open an ra_local session to URL
    Unable to open repository ‘file://ip add/svnrepos/speedfc’

    How to do that,

    can u please provide your mail id or contact details.

    Thanks
    PASHA.

    • April 24, 2011 at 1:54 pm | #12

      Dear Pasha,

      You can reach me at jyotsnas@philogy.com

      By looking at the URL being accessed, I see its file:. You may want to try accessing the repository with “svn:” instead of “file:”. If you have ssh too on linux, you may want to try “svn+ssh:” in URL.

      Do write me for any queries/ questions/ feedback.

      Jyotsna

  9. PASHA
    April 25, 2011 at 7:59 am | #13

    Hi,

    Thnks for reply,
    and you are accesing it through the user name “svn+ssh://username@servername/path/to/repo/RepoName”, which username system user name or we need to add the user in conf dir.
    I deleted and created new repository /svnrepo
    I am acccessing form windows like svn://ip-add/svnrepo/, bot getting ans like
    //svnrepo/conf/svnserve.conf:12:Object expected

  10. PASHA
    April 25, 2011 at 8:06 am | #14

    sory thats anothe one

    configured as

    svn://ip-add/svnrepo/speedfc through the windows, Tortosin SVN,

    getting reply like – No svn repository found in “svn://ip-add/svnrepo/speedfc”

    need more litle bit help.

  11. Suresh Chowdhury
    May 12, 2011 at 4:42 am | #15

    Thanks Dear.

  1. December 29, 2010 at 3:09 pm | #1

Leave a Reply

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

Gravatar
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 )

Connecting to %s

Follow

Get every new post delivered to your Inbox.