Subversion

From CT Wiki
Jump to: navigation, search

A version control service based on subversion (or svn) is offered by the Computer Technology group. Subversion access is supported on all platforms and by most developer tools and environments, including HDLworks EASE. These Wiki pages describe for end-users how to set up Subversion access on Windows and Linux in order to access the CT Subversion service.


Contents

CT Subversion service

The CT Subversion service can be found at

 svn+ssh://svn.nikhef.nl

(and also at svn+ssh://marron.nikhef.nl)

It currently offers the svn+ssh protocol only, for both internal and external users. There is also read-only support using viewvc:

 http://svn.nikhef.nl/viewvc

Finally, read-only access to the Subversion repositories is available from within the Nikhef networks via

 http://svn.nikhef.nl/ro/et

Access for different users and groups

Access to the CT Subversion service is controlled using special subversion accounts for each project or group. This tutorial was written for the Electronics Technology (ET) group. For this group, a special user etsvn was created. Those members of the ET group that require access need to have a special LDAP attribute set, which the helpdesk can do for you. The attribute is:

  etSubversionUsers

Non-Nikhef employees can also get access to the CT Subversion service as long as a Nikhef employee will sponsor them. These external users will then receive a very limited account (affiliate account), which will grant them access to the Subversion service only.

Platform support

  • Windows XP, 7, 8
  • Linux (mostly Scientific Linux 6, but SL5 works too, as well as almost any other distro)
  • MacOS X (<--- TODO!)

Setting up Subversion access on Windows

The most commonly used Subversion client for Windows is TortoiseSVN (http://tortoisesvn.net/). It is freely available and it in turns makes use of the freely available PuTTY SSH client (http://www.chiark.greenend.org.uk/~sgtatham/putty/).

In order to set up Subversion access we need to

  • install PuTTY
  • generate a PuTTY Privatekey file using PuTTYGen.exe
  • configure the PuTTY Pageant (the Windows ssh agent)
  • add the SSH key to your Nikhef SSO account (also for external users!)
  • install TortoiseSVN
  • configure TortoiseSVN to use svn+ssh using PuTTY
  • Test everything

Install PuTTY

The latest version of PuTTY can usually be found at http://the.earth.li/~sgtatham/putty/latest/x86/putty.zip

Download it and extract all files into a single directory. It is easiest if this directory is added to the Windows PATH. In this tutorial the files were extracted to C:\Utils

Generate a PuTTY Privatekey file

An SSH public/private keypair is by far the easiest method to access the CT Subversion service (as well as some other CT services!).

  • For this, we need to set up such a public/private keypair once. This is done using the PUTTYGEN.EXE executable. Launch it:

Etsvn-puttygen.png

  • Click on the 'Generate' button and move the mouse

Etsvn-puttygen2.png

  • Once the generation is complete, fill in the description, choose a passphrase (password) and save the PuTTY private key by clicking on 'Save Private key'.

Etsvn-puttygen3.png

In this example the PuTTY private key was saved as 'etsvn.ppk'

  • If you wish to use this same SSH key on Linux, export it as an OpenSSH private key as well (Conversions->Export OpenSSH key):

Etsvn-puttygen4.png

In this example the OpenSSH private key was saved as 'etsvn' . Similarly the public key was saved by clicking on the 'Save Public key' button.

Notes

  • PuTTY does not need the OpenSSH public or private key files.
  • Leave the PUTTYGEN application running, we will need it later on.

Configure the PuTTY Pageant

The PuTTY Pagent (PAGEANT.EXE) is (roughly) the Windows equivalent of the Linux ssh-agent process. Launch it, after which is normally nestles itself into the Windows taskbar.

  • Open it by right-clicking on it:

Etsvn-pageant1.png

and select the 'Add key' menu item.

  • A prompt will pop up, asking you to select the PuTTY private key file:

Etsvn-pageant2.png

Note: it is possible to specify keys on the command-line or inside a short-cut icon so that one or more keys are automatically loaded when the Pageant start.

  • Enter the passphrase for the PuTTY private key:

Etsvn-pageant-passphrase.png

  • If the key was loaded successfully it will appear as if nothing happened. Right-click on the Pageant icon again and select 'View keys' to bring up the keys loaded into the Pageant:

Etsvn-pageant-keylist.png

In this example, the second key marked 'ET SVN Access' is the key that was generated in the previous step of this tutorial.

Add the SSH key to your SSO account

In order to use your SSH key with the CT Subversion service you must add your SSH public key to your Nikhef SSO account. This can be done as follows:

  • Browse to
 https://sso.nikhef.nl

Etsvn-sso1.png

  • Click on 'Change your configuration' then log in using your SSO credentials:

Etsvn-sso2.png

  • After successfully logging in, first switch back to the PUTTYGEN application and select the 'Public key for pasting in OpenSSH authorized_keys file':

Etsvn-puttygen-select-authkey.png

Use Ctrl+C to copy the public key.

  • Now paste (Ctrl+V) this key into the SSO 'chsh' page, fill in your SSO password again and click OK:

Etsvn-sso-chsh.png

Note as you can see in the example above it does not really matter if you remove the comment string (ET SVN Access) or not.

  • Your SSH key is now being processed. It can take upto ten minutes before the CT Subversion service picks up this new key:

Etsvn-sso-updating.png

Install TortoiseSVN

The latest version of TortoiseSVN can be found at http://tortoisesvn.net/downloads.html for both 32bit and 64bit Windows.

Download the appropriate version and install it just like any other Windows package (Note: you will need Administrator privileges for this!)

  • Run the install package:

Etsvn TortoiseSVN1.png

  • Make sure the commandline tools are also installed:

Etsvn TortoiseSVN2.png


This is needed for EASE for Windows.

Configure TortoiseSVN

If TortoiseSVN is properly installed then there is only one step required to make use of the PuTTY key generated and loaded previously.

A system environment variable needs to be set, so that the TortoiseSVN subversion tools will pick up the right SSH executable. Adding a Windows environment variable is different for each version of Windows, here are the screenshots for the nearly-obsolete Windows XP:

  • right click on the 'My Computer' icon and select 'Properties'
  • click on the tab 'Advanced' and then select the button 'Environment variables':

Etsvn-systemprops.png

  • A new window will pop up. Click on 'New' to add a new environment variable:

Etsvn-add-env-var.png

IMPORTANT NOTES

    • The name of the environment variable is case sensitive: SVN_SSH
    • The value of the environment variable is full path to the TortoisePlink.exe executable, with Windows backslashes ('\') convert to forward slashes ('/')!
    • Do not use the PuTTY PLINK.EXE executable as you will see DOS boxes pop up many times every time you check in or check out code from subversion
  • After clicking OK the list of user environment variables is updated:

Etsvn-env-vars.png


TortoiseSVN is now configured to use svn+ssh!

Test everything

  • Make sure the PuTTY pageant is running and that the right Privatekey is loaded
  • Open the Windows explorer and create a new directory where you want to check out a project
  • Right-click on this directory and select 'SVN Checkout'. If this option is not present then you did not install the TortoiseSVN Explorer integration
  • Check out the project of your choice:

Etsvn-tortoise1.png

The UR: of the repository for ET users is

 svn+ssh://etsvn@svn.nikhef.nl/<project name>
  • Click OK and watch magic happen
  • If the checkout went OK you will see the following screen:

Etsvn-tortoise2.png

  • Your Windows explorer screen will now show that the directory is managed using Tortoise SVN:

Etsvn-exlorerview.png

  • Next, open a command prompt and verify that a checkout on the commandline also works:

Etsvn commandline.png

Setting up Subversion access on Linux

Setting up Subversion on Linux is quite easy; just make sure the package 'subversion' is installed and/or that the command 'svn' can be found in the system's path.

SSH access using an OpenSSH public/private keypair is much more common on Linux, but it depends on your Linux distribution how well it is integrated into your desktop environment.

Generate an OpenSSH public/private keypair

  • To generate a new OpenSSH public/private keypair, use
 $ ssh-keygen -b 1024 -t rsa -C "ET SVN Access" -f ~/.ssh/etsvn
 Generating public/private rsa key pair.
 Enter passphrase (empty for no passphrase): 
 Enter same passphrase again: 
 Your identification has been saved in /home/janjust/.ssh/etsvn.
 Your public key has been saved in /home/janjust/.ssh/etsvn.pub.
 The key fingerprint is:
 14:27:0b:36:e8:07:89:a4:dd:0a:87:62:b1:2e:6b:92 ET SVN Access
 The key's randomart image is:
 +--[ RSA 1024]----+
 | o.. o+ o .      |
 | ++.+. o =       |
 |=oo...  o        |
 |+o .. ..         |
 |...  .  S        |
 |.o               |
 |E.               |
 |o                |
 |                 |
 +-----------------+
  • To use this key, make sure that the ssh-agent process is running and then type
 $ ssh-add ~/.ssh/etsvn
 Enter passphrase for /home/janjust/.ssh/etsvn: 
 Identity added: /home/janjust/.ssh/etsvn (/home/janjust/.ssh/etsvn)
  • You can verify that the key is loaded using
 $ ssh-add -l
 1024 61:0e:91:ad:8c:41:6b:c0:66:b0:68:d6:b2:e8:7a:af /user/janjust/.ssh/id_rsa (RSA)
 1024 14:27:0b:36:e8:07:89:a4:dd:0a:87:62:b1:2e:6b:92 /home/janjust/.ssh/etsvn (RSA)
  • Find the OpenSSH public key
 $ cat ~/.ssh/etsvn.pub
 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEA5WyUdm+ZOJfShgaEB/zDO5LqWzSyl95N738HBnN1p0McAz
 zK5Gr9oRH0BmnFjjCIgsHBw6B+0gTuimOMMo5i2FWWbipLURxtVr4pCOZlET4/hoegey+fUomS2bsgLbRw
 ni6LnrEWcb61p564PvdyWLA8TwoM8FbwbeNMieaQf/c= ET SVN Access

Add the SSH key to your SSO account

Add this new SSH public key to your SSO login information. Screenshots on how to achieve this are listed above for Windows users. The same procedure applies to Linux and MacOS.

Test subversion access

Now verify that you can check out a Subversion project using the new key

 $ svn co svn+ssh://etsvn@svn.nikhef.nl/project3
 Checked out revision 0.

Setting up a repository

In theory, "normal" users are allowed to set up their own Subversion repositories. For details, read the page Setting up a new Subversion repository.

In practice, you will need

  • write access to a common folder
  • for a new group of users a generic account may be required
  • if access to external users needs to be given then a generic account IS required
  • talk to the helpdesk

Integration with other software

Subversion support is available in many applications, which is one of the main reasons to offer Subversion as a version control system next to tools like 'git'.

Ease

For the Electronics Technology group the primary application is http://www.hdlworks.com.

Instructions on how to enable subversion support in Ease can be found here.

Views
Personal tools