Using command line subversion with svn+ssh and identity file

Apache Subversion (SVN) is a good and commonly used versioning tool. Even if there are a lot of graphical interfaces for it you sometimes have the need to use it on command line (using the svn client) or it can be your choice. Anyway using Subversion this way isn’t very difficult, just a little bit less comfortable.

A secure system configuration requires that connections to your remote repository will be tunneled through SSH and a more secure configuration avoids password and uses identity files. The question is: how can i pass the position of my identity file to svn? And the user to use on the remote machine?

The solution is not obvious, but really simple: use the ~/.ssh/config file!

The SSH config file allows you to set different values to be used when connecting with SSH. This is a example:

Host example
HostName www.example.com
IdentitiesOnly yes
IdentityFile ~/.ssh/id_dsa
User admin

Every time you try to connect to www.example.com the given identity file and username will be used. Very easy!

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *