in Blog Posts, Solution

Check out your svn copy through ssh without those annoying password prompts

This is an instruction I wrote to help people in our lab to access codebase on our server. I have removed all the specific information.

Since setting up something on Windows is always such a challenging work, help this one helps.

The background is that, on the server side, you are using ssh to protect your codebase. Instead of setting up another group of users and passwords for the svn repository separately, the server asks user for one’s Windows credential. So, on the client side, user are using commands in the form of “svn co svn+ssh://path/to/repository” to checkout a copy. Please note that the scheme for the url of repository is “svn+ssh” instead of “svn”. It tells the svn to connect to the server by using ssh then checkout the source code.

I may post a tutorial on how to setup the server ON WINDOWS in the future.

Please follow this instruction to check out a sample repository.

1. Install SVN Client “TortoiseSVN”
Open http://tortoisesvn.net/downloads.html in your web-browser, choose “TortoiseSVN 64-Bit”/”TortoiseSVN 32-Bit” to download the installation program. Open it and keep clicking “next” to finish the installation.

2. Have a try
Open your windows explorer, get in a folder such as “C:\Repo”, right click on anywhere blank, choose “SVN Checkout…”.
The URL of repository is “svn+ssh://path/to/your/repository”.
Click “Ok”.
You will be prompted for your username and password for THREE times then you should get the files.

3. I can’t stand this!
Yes it’s quite annoying to repeat filling your credential, remove the folder and we will try to get rid of this.

4. Utilities
If you are on an unix-based machine, google for “ssh key” you get A LOT OF tutorials on this topic, for example http://linuxproblem.org/art_9.html.
If you are on WINDOWS, open this PuTTY Download Page http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
You will need PuTTY.exe, Pageant.exe and PuTTYgen.exe

5. Generate Key Pairs
Launch PUTTY.exe, fill in the Host Name as “Your.Repository.Host.Name”, click “Open”.
Input your credential, note that when you type in your password there will be “no response”, it is ok, just go ahead.
You should meet our Hippo now.
Type in “ssh-keygen.exe”
Keep hitting the “Enter” button.
Type in “cd ~/.ssh”
Type in “mv id_rsa.pub authorized_keys”
Type in “ls” and you should see this:
“authorized_keys id_rsa”
id_rsa is your private key.
Type in “cat id_rsa”
Scroll up and highlight/select lines from “—–BEGIN RSA PRIVATE KEY—–” to “—–END RSA PRIVATE KEY—–“, including these two lines.
Hit “Ctrl+C” to copy them.

6. Make your private key file
Create a new text file in certain folder, e.g. “My Documents”, “Ctrl+V” to paste lines in this file, save it in a name e.g. “ssh_key.txt”.
Launch PUTTYgen.exe, choose “load”, in the dialog change the extension to “All Files” and find your “ssh_key.txt”, click “open”.
Click “Ok” when anything pop out.
Choose “Save Private Key”, get a name for it such as “ssh_key.ppk” and click “save”.

7. Come on, we are almost there
Launch Pageant.exe, nothing happen? Right, it hides in the task bar. Right click on its icon and choose “Add Key”.
Find your “ssh_key.ppk” and choose “Open”.

8. Have another try
Ok, Repeat Step 2, you should be able to get all the files without entering any credential.
Cheers!

Write a Comment

Comment