SVN Usage Reminder and Examples

SVN Usage Reminder and Examples

Last updated:

checkout a project over SSH

$ svn checkout svn+ssh://username@hostname/svnroot/path/to/your/repo project_dir

where:

username is the username you use to log into the server

hostname is the address of the server where the svn repos are located

svnroot/path/to/your/project is the path to your svn repo

project_dir is the name of the directory into which you want to checkout the project. It's created if it doesn't exist.

initialize a local repository with files

say you have created an empty repository in /home/foo/bar:

$ cd /home/foo/
$ svnadmin create bar

And you have some code in /var/www/my_project. In order to initialize your repo with your code, you would do something like this:

$ cd /var/www/my_project
$ svn import . file:///home/foo/bar -m "initializing repository with project files."

Your repo now contains your project files. But the current directory you're in right now doesn't know anything about it so you can't commit or update files just yet. So delete the files and do a checkout:

$ rm -rf ./*
$ svn checkout file:///home/foo/bar