svn+ssh with specific identity file
I was trying to check out using something like this:
svn co svn+ssh://[email protected]/desired/path
To do this, I created this file: ~/.ssh/config and in it I put the following:
host lornajane
HostName svn.example.com
IdentifyFile /path/to/private_key
Now I update my checkout syntax to make use of my alias rather than specifying the host directly, like this:
svn co svn+ssh://lorna@lornajane/desired/path
SSH realises that it should pull the host information from your local config file, and uses your HostName, IdentityFile and any other settings you specify (there are many options, see this reference for more information. For example I often use this for port numbers if I’m tunnelling my SSH between places, the possibilities are endless.
Hope this helps, if you’ve got anything to add then I’d be delighted to see a comment from you.
Hi Lorna,
We’ve started using SVN externals quite a bit, which was an issue when we were using usernames within the URL. On Windows we’ve changed the ‘ssh’ tunnel for Subversion to use our own usernames, which isn’t great as it means we need different tunnel addresses for different config changes.
Using the ‘User’ keyword in the ssh config in your example would solve this on Linux systems, however I’d be interested to know if any Window users have a way of setting this up on a per host level, rather than a per tunnel level.
Is there a specific reason you don’t use the User keyword in your config?
=D
Dom: I can’t answer your windows question but hopefully someone else will! As for my username, no reason at all for it not being in the config. I usually specify everything in full, and I only used the config in this example to specify things that I couldn’t add into the svn_ssh command. The rest is still as it usually is purely out of habit I think, I don’t feel strongly either way.
Hello,
you solved my problem, I added the config file so that svn connects to an svn running into an EC2 instance.
Strangely enough, though, in a Mac, with Firefox, Safari or Chrome I see nothing under the line
“To do this, I created this file: ~/.ssh/config and in it I put the following:”, it didn’t matter in my case since just by adding IdentifyFile in the config file it worked.
Thanks and regards,
Pau
Pau: thanks for your update, I’ve been having some problems with my geshi plugin “eating” some, but not all, code snippets in old posts. Glad the article was helpful :)
its IdentityFile, not IdentifyFile.
Identify with an F will throw an error.
> Now I update my checkout syntax to make use of my alias rather than specifying the host directly, like this:
>
> svn co svn+ssh://lorna@lornajane/desired/path
A better way is to use svn switch instead of redo the check out of the repository:
svn switch svn+ssh://[email protected]/desired/path svn+ssh://lorna@lornajane/desired/path path
This was a new checkout, but thanks for your example using switch – I recently moved my SVN server between hosts so I’ve been “switching” a lot of checkouts lately. This is a good tip
Please change your original posting to “IdentityFile” rather than “IdentifyFile”.
Nice tip! However ‘IdentifyFile’ should read ‘IdentityFile’ in original post.
May be able to do similar by editting .subversion/config. Thanks.
Thank you so much :)
You solved my problem. Finally I found that I must put number of the port in the config file, like:
[code]
Host MyServer
HostName myserver.com
Port 1992
IdentityFile ~/.ssh/mykey.pem
[/code]
Then I just need to run this command:
[code]svn co svn+ssh://myuser@myserver/my/repository/path[/code]
I have installed SVN server and all is working fine on svn commit, svn checkout and svn update if I have done the svn checkout using file:///var/www/svn/repos
But when i do svn+ssh it gives authentication failed.
svn co svn+ssh://[email protected]/var/www/svn/repos/xfer1.0/ mmt_live/
svn: Authentication failed
Killed by signal 15.
But when i do svn co svn co file:///var/www/svn/repos/xfer1.0 it works fine.
Any help what is wrong why i am getting this Authentication failed.
Check that you can SSH to that user@host combination first, then try again with the SVN once you have the SSH working. It sounds like you don’t have SSH access or it isn’t quite configured correctly.
Alternately:
$ export SVN_SSH=”ssh -i /path/to/private/key/file”
$ svn co etc.
you’ve got a typo in your instruction.
it is called IdentityFile and NOT IdentifyFile …!