Sunday, November 3

Create a local svn repository

Today I created a local svn repository to keep version history of modification. It is a task long overdue.

Why to create svn in local machine?
Pro:
1. local management. There is no network latency.
2. version history is important.

Con: doesn't have disaster recovery from remote copy.

It is a trade-off between how important your data is and how resourceful you are.

Here are the steps to create it in my Ubuntu 12.04:

To minimize the footprint, I use "direct repository access (on local disk)" (Reference: https://help.ubuntu.com/community/Subversion#Access_Methods) in /home/svn.


  1. sudo apt-get install subversion            # of course.
  2. sudo mkdir /home/svn
  3. sudo chown ben /home/svn      # make myself the owner of this folder
  4. svnadmin create /home/svn/django           # create repository.  note: this is created under my own account.
    #because I already have some sites, I need to add them into the repository
  5. cd ~/mysites
  6. svn import "file:///home/svn/django" -m 'initial import'
    # one thing bothers me is that, after importing, the files ARE in repository, but the current folder ~/mysites "is not a working copy" yet, because there is no .svn folder create here.
    # so I have to check out the folder from the repository:
  7. svn checkout "file:///home/svn/django"
  8.  # the files are checkout into ~/mysites/django folder.   # this folder is good to use, you can commit/update now.