From Christoph's Personal Wiki
Jump to: navigation, search

Subversion (SVN) is a version control system. It allows users to keep track of changes made over time to any type of electronic data. Typical uses are versioning source code, web pages or design documents.

The article will cover the Subversion command-line client (or just svn) for version >= 1.4.3.


usage: svn <subcommand> [options] [args]

Type 'svn help <subcommand>' for help on a specific subcommand. Type 'svn --version' to see the program version and RA modules

 or 'svn --version --quiet' to see just the version number.

Most subcommands take file and/or directory arguments, recursing on the directories. If no arguments are supplied to such a command, it recurses on the current directory (inclusive) by default.

Available subcommands

blame (praise, annotate, ann)
checkout (co)
commit (ci)
copy (cp)
delete (del, remove, rm)
diff (di)
help (?, h)
list (ls)
move (mv, rename, ren)
propdel (pdel, pd)
propedit (pedit, pe)
propget (pget, pg)
proplist (plist, pl)
propset (pset, ps)
status (stat, st)
switch (sw)
update (up)

Howto setup a svn repository

Note: This 'howto' will show how to setup a Linux Subversion Server (repository), using SSH client access (using the svn+ssh protocol with svnserve -t).

  • Step 1: Create a group for svn
groupadd svnusers
  • Step 2: Set default permissions in the .bashrc file:
umask 002 # allow user + group to write, no other.
  • Step 3: Create a svnadm user account:
useradd svnadm

Note that a default user might have already been added when svn was installed (e.g., user svn); you can use the default user, if you like.

  • Step 4: Create a root path for the svn repositories:
mkdir -p /path/to/svn/repositories

and restrict access to this area only for root and svn users:

chown -R root.svnusers /path/to/svn/repositories
chmod -R u+wrx,g+wrx,o-wxr /path/to/svn/repositories
  • Step 5: Create a svn project repository:
su svnadm  # make sure you do this as user 'svnadm'
svnadmin create /path/to/svn/repositories/myproject

and restrict access via

chmod -R o-rwx /path/to/svn/repositories/myproject
  • Step 6: Configure the (new) project:
vi /path/to/svn/repositories/myproject/conf/svnserve.conf

and add the following:

anon-access = none
auth-access = write 
  • Step 7: Test SSH client access (on localhost):

Log in to one of the svn users and try:

svn list svn+ssh://<user-id>@localhost/myproject

It should return a list of your project files. If it does, your svn repository is ready to use.


If the above does not work, it could be that your firewall is not allowing the appropriate traffic in, out, or through. Make sure the following ports are open for svn:

svn       3690/tcp   # Subversion
svn       3690/udp   # Subversion

See iptables for examples on how to do this.


  • Typical "download" command:
 svn co pymmlib

See also

  • Git — Fast Version Control System

External links