A few months ago I embarked on setting up svn on a new server of ours. After countless tutorials, docs etc… I was convinced that my co-worker and I had uncovered some secret society like the magicians guild or something. After a few days of hacking away and the whole trial/error process I learned that I was looking at the way svn works the wrong way which was causing the errors. So Here’s my quick and basic tutorial for svn which I proudly display on my companies vast wiki.
Quick Rundown:
1. Setup SVN via yum, apt-get or RPM on your server( some server companies have a control panel option for this )
2. Setup a new repository
3. Create a file structure
4. Import the Repository
5. Checkout the repository trunk to the web root dir
6. Setup hooks, permissions and svn:ignore’s
7. Run a svn commit and svn update to ensure everything is working
Long Version:
1. Setup SVN like I said above. Should be a simple process for your lin flavor via shell.
2. Setup a new repo by running
svnadmin create /opt/svnserve/REPONAME --fs-type=fsfs
(The fstype switch is used for creating a berkley based db schema - I’m not sure why you use this, but someone much wiser than me said just f****** use it - someday I’ll read all the docs and find out why —also, you can put the repo anywhere you want—we just decided to put it in the /opt/svnserve/ dir)
3. Create a file structure like this in /tmp/reponame +branches +tags +trunk files go here(underneath the trunk)
so this is pretty simple just create a tmp file structure using mkdir to add branches, tags, trunk ... put all your webroot files in the trunk folder(my webroot is /home/webadmin/development.local-motors.com/html/ so I put a html dir in the trunk w/ all my files in it.
4. Import the repo like this:
svn import /tmp/reponame file:///opt/svnserve/REPONAME -m “Initial Import”
(the -m switch is just a comment)
5. Checkout your new repo to the webroot dir like this:
svn checkout file:///opt/svnserve/REPONAME/trunk /home/webadmin/SOMESERVER.com/html
(so basically here you are checking out a working copy of the repo located in /opt/svnserve… to your servers webroot.
6. Setup Hooks, permissions and svn:ignores Hooks are located in the /opt/svnserve/reponame/hooks/ —generally you’ll just use a post-commit, but there are other options there for us to enhance our system in the future(i.e. pre-commit etc)
(our post-commit is pretty basic ... it calls a shell script that runs an svn update)
Perms are set in the /opt/svnserve/conf
set the passwd and the svnserve.conf files up. Make sure you change the anon access to none so everyone won’t be able to see your code.
Setup the svn:ignore—this one is a little tricky. Basically you want to run this command
~/.subversion/conf and edit the line that has editor in it. Take out the pound sign and for the variable use vim. save and close (ESC :wq
now go to your web root(html) and for each folder you want to be ignored do this:
svn propedit svn:ignore FOLDERNAME.
You now are taken magically to the svn editor(aka VIM)
If you want to ignore the entire dir just enter a *
If you want to ignore a specific file or certain extensions do this:
config_select.php
.jpeg
*.gif
Get the idea - just use wildcards and you’ll be o.k. I promise
7. go into the html dir and edit a file – any file. Now save and close then do an
8. Hopefully everything went well. If it did run an svn update . to finish the process(note the period in the last two steps. There are other ways to do this, but this is how i do it.
Oh and 1 other thing—google for svn or subversion quick start ... that’s the official docs