After finally getting round to setting up version control for my personal sites I thought i’d record the process of installing subversion on my Mac and setting up the repositories for future reference.
Installation
First i needed to create a .bash_login file and set the PATH:
1234 mate ~/.bash_loginexport PATH="/usr/local/bin:/usr/local/sbin:$PATH"
I found it is important to have /usr/local/bin
and /usr/local/sbin
first in the path.
123 . ~/.bash_login
Next I downloaded, extracted and configured ‘subversion’, before installing it:
123456789 curl -O http://subversion.tigris.org/downloads/subversion-1.3.2.tar.gztar xzvf subversion-1.3.2.tar.gzcd subversion-1.3.2./configure --prefix=/usr/local --with-openssl --with-ssl --with-zlibmakesudo make installcd ..
Ignore warnings about “missing” Berkeley DB.
Setting Up Repository
Next I created the svn directory and repositiory:
1234 mkdir /usr/share/svnsvnadmin create /usr/share/svn/repos
Then importing my projects into the repository I just created, e.g. if the project i’m working on is currently in /katie/sites/project:
12345 cd /katie/<tt>sites</tt>svn import project file:///usr/share/svn/repos/project -m "Initial import"
Now I have a repository of the project I must check out a working copy:
123 svn checkout file:///usr/share/svn/repos/project
Committing Modified Files
When trying to commit files I had modifed to the repository i encountered the following error:
svn: Can’t open file ‘/usr/share/svn/repos/db/txn-current-lock’: Permission denied
This is a simple permissions problem, you need to have write permission on the repository directory:
123 sudo chown -R $(id -u):$(id -g) MyDirectory chmod -R u+w MyDirectory