Post details: Using Cygwin, Keychain, SVN+SSH and TortoiseSVN in Windows

May 03, 2005 : Using Cygwin, Keychain, SVN+SSH and TortoiseSVN in Windows

This is verbatim from my friend Andy:

How to use Cygwin, Keychain, SSH and TortoiseSVN together in windows.

A while back, I set up keychain to work under Cygwin so that I could easily manage various SSH keys with ssh-agent, since I prefer to use public keys for authentication.

I think that TortoiseSVN is a useful SVN client with a handy shell extension for Windows.

Recently, I switched Subversion servers to one which requires ssh+svn authentication. Having gotten used to typing my passphrase in once per session, I soon grew tired of punching the whole thing in every time.

Here's how you can set up TortoiseSVN to use SSH keys managed by keychain:

I'll assume you already have WindowsXP (though perhaps other versions would work as well), Cygwin, SSH, Keychain, and TortoiseSVN all installed and working properly, including setting up public/private key pairs and deploying them properly to the target SSH servers, including the svn servers you wish to use. This may not be as easy as it sounds, but there is good documentation on the web sites for each of these tools.

Create a batch file in a convenient location, called something like ssh.bat, containing the following line, replacing the paths to bash and ssh as appropriate:

c:\Cygwin\bin\bash.exe --login -c "/usr/bin/ssh %*"

Now open up the TortoiseSVN settings by right-clicking on a folder in the explorer and browsing the TortoiseSVN context menu.

In the Network tab, set the SSH client to the ssh.bat file just created.

Now, if you haven't already done so, open cygwin. Keychain will ask you for one or more passphrases for your SSH keys. Once the keychain session is created, any further interactive bash sessions will have access to the ssh-agent.

From now on, whenever you attempt to use TortoiseSVN to connect to a Subversion server using svn+ssh authentication which you've set up with your public keys, you won't have to enter a password or passphrase.

Comments, Pingbacks:

Comment from: Dad [Visitor]
Permalink 2005-05-04 @ 06:59
Comment from: Karl Jorgensen [Visitor] ·
Thanks - that little script comes in *very* handy!
Permalink 2006-06-06 @ 05:50
Comment from: matt [Visitor] ·
Thanks. This really helped me out. I was being bombarded with login prompts when I look at the revision longs and when I selectivly update multiple folders.
Permalink 2006-09-13 @ 17:04
Comment from: uzyn [Visitor] ·
Thanks. This is really helpful.

However, I wonder if there's a way to make the cmd.exe windows not popup during every SVN requests, or at least not changing my focus to the windows?

Permalink 2006-12-11 @ 13:15
Comment from: Patrick Camilleri [Visitor]
Great explanation! Just got it running. I'm still trying to understand how it works though. In particular I don't understand what the '%*' in c:\Cygwin\bin\bash.exe --login -c "/usr/bin/ssh %*" does. Would be grateful if somebody points me in the right direction.

I basically had the same thing running with putty and pageant but somehow I discovered that the ssh client from cygwin fetches files faster especially over a slow connection.

Permalink 2007-02-09 @ 17:23
Comment from: Alex [Visitor]
You can also skip the creation of the little .BAT launcher AND suppress the console windows by simply using the following as the SSH Client in TortoiseSVN Settings:

C:/cygwin/bin/run C:/cygwin/bin/ssh
Permalink 2007-02-19 @ 10:43
Comment from: dethrophes [Visitor]
to supress a console just type
start "" /b /min c:\Cygwin\bin\bash.exe --login -c "/usr/bin/ssh %*"

%` means all command line argúments

similar to %1 %2 %3 %4 %5 %6 %7 %8 %9
I say similar because it pases all cmd line arguments
Permalink 2007-06-20 @ 22:13
Comment from: Kevin Dahlhausen [Visitor] ·
I had to use this (with the original batch file from above) to get hidden windows to work:

c:\cygwin\bin\run.exe c:\cygwin\usr\local\bin\ssh.bat
Permalink 2008-10-01 @ 15:36

Leave a comment:

Your email address will not be displayed on this site.
Your URL will be displayed.
What is the 2-letter abbreviation for Michigan?
Allowed XHTML tags: <p, ul, ol, li, dl, dt, dd, address, blockquote, ins, del, span, bdo, br, em, strong, dfn, code, samp, kdb, var, cite, abbr, acronym, q, sub, sup, tt, i, b, big, small>
(Line breaks become <br />)
(Set cookies for name, email & url)

<  January 2020  >
Mon Tue Wed Thu Fri Sat Sun
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    




Syndicate this blog XML

powered by