Beginning the SVN Journey

Note: This post is over 2 years old. You may want to check later in this blog to see if there is new information.

Alright, we’re beginning our Subversion tutorials today. Subversion is a revision control system, and for our purposes we’re going to be setting it up for web development, and using this blog as an example. For those of you preparing to join me on my SVN exploration, you’re looking at what appears like it’s going to be an 8 or 9 part series. I’ve got it all laid out and am confident enough now to share my experiences. We’re going to start with a prerequisite in part I today: Password-less SSH. Note: I work in OS X, and while most of this material is cross-platform, there will be frequent OS X references.

Keyless Entry

Because of its simplicity, I ended up choosing to use the svn+ssh protocol for all of my work
with the blog, and for future subversion based web development. In order to do this efficiently, and to be able to write shell scripts that automate the process, we need to be able to bypass the usual password requirements of SSH. This may be rudimentary for some of you, but as I mentioned, it’s a prerequisite for what we’re going to cover later, so that’s where we’re beginning.

I work in OS X, and the ssh that comes packaged with Tiger is “broken”, in that it’s missing the askpass command. That’s alright, we’re not going to need it, as this is a solution for that problem as well. We’re going to use public and private keys stored locally and on the server and accessed through an authorized users file by the remote ssh program.

Locksmithing

To generate the keys on our local machine, we’re going to head for the command line (Terminal). You should be in your home folder, if you’re not, type:

cd ~

If there’s not a directory called .ssh there, create one:

mkdir .ssh

Next, we’re going to use the ssh-keygen command that’s included with the ssh package to generate the keys and place them in the ssh directory. Type:

ssh-keygen -t dsa

When asked for a filename, you can leave it at the default or call it what you like, and when asked for a passphrase, leave it blank and hit enter unless you know to do otherwise. In order to function properly, the private key needs to only be readable by you, so run:

chmod 600 .ssh/id_dsa

to change its permissions.

Special Delivery

You need to get your public key (id_dsa.pub or whateveryounamedit.pub) to the remote machine. You can ftp if you want to, but all the cool kids are using scp. The syntax is basically:

scp .ssh/id_dsa.pub user@yourserver.ext:

The trailing colon is intentional. You’ll be asked for the password for the specified user. Once this system is set up, you should be able to use the same command without manually entering a password.

Setting up the Server

These instructions assume a Linux server, if you need other resources, please consult Google. Go ahead and ssh to the remote computer using a password:

ssh user@yourserver.ext

The id_dsa.pub file that you just scp’d should be in your home directory (~). Create another .ssh folder if it’s not already there. Then type:

cat id_dsa.pub >> .ssh/authorized_keys

The double >> will append the text to the file if it already exists, or create a new one if not. At this point you can delete the id_dsa.pub file (rm id_dsa.pub) from your home directory. Set the permissions on the .ssh folder to 700

chmod 700 .ssh

You can log out of your remote host now.

Testing, Testing…

If all went as planned you should be able to log back in with the same command as before:

ssh user@yourserver.ext

It should connect with no password prompt. If so, congratulations! If not, repeat the process or consult the ssh man page if necessary.

Reference: How to set up SSH (for the beginner)

» » » » » »
  1. Circle Six Blog » Blog Archive » Working with Subversion 04.15.07 / 4pm

    […] with Subversion Table of contents for Subversion SeriesBeginning the SVN JourneyWhy I’m Using SubversionInstalling SubversionGetting started with SVNWorking with […]

  2. Subversion for Web Developers § Blog Archive § Lincoln Loop | Steamboat Springs, Colorado 04.24.07 / 6pm

    […] some other really nice features to boot. Luckily, right about the time my Mac arrived, Circle 6 did a fantastic right up on using SVN to manage your websites. If you aren’t familiar with Subversion, go read their series now, the rest of this will make […]

  3. C-Sixty Concepts » Installing Subversion on Fedora Core 04.24.07 / 6pm

    […] also found a pretty good series of articles here at Circle Six Design around general SVN topics and getting started. They have certainly helped me […]

  4. Matthew Anderson 10.10.07 / 5pm

    I could not, for the life of me, remember how I had previously accomplished this. Thanks for the reminder, Brett!

  5. Whatever-ishere 11.21.07 / 10am

    thanks for the GREAT post! Very useful…

  6. Matt 05.18.08 / 9am

    Fantastic! Thank you. One additional note, on the server-side i had to chmod 600 ~/.ssh/authorized_keys

Have your say

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>




Safari hates me