Overview

  • the following repository tools are installed on our systems, including the repository server(s):
    • CVS
    • Subversion
    • Git
      for Git a notification post-hook is implemented (pvw: see /repos/hldvt2009/hooks/post-receive)
      if you know how to do that for the other types of repositories and want to use it, we can try to implement it as well (with your help ;-)

Using the repository tools, you can set up and use repositories in 2 ways:

  • in your home directory or any other directory you have (write) access to.
  • on a dedicated repository server.

Please take into account that everybody that wants/needs to use a repository in your home or other directory, needs to have an account on the departmental systems:

  • all accounts that need access must be member of the same group
  • all accounts that need write access must have (enough) quota on the file system / partition containing the repository
  • all files and directories in the repository must be changed to that group, with the chgrp command
  • that group must be given write access to all files and directories in the repository, with the chmod g+w command
  • directories probably need also the group s-bit (with chmod g+xs), such that new files automatically belong to the that group

Therefore we advise against setting up a repository in your home directory, except for small, private or test cases ... experience shows that using a repository always expands to a size where the above limitations really make life difficult.

For a repository of reasonable size and scope, consider to use a repository server ... ask your systems group representative for more information. On repository servers the above requirements are implemented automatically and disk usage/repository size is only limited by the size of the disk.

    There is a departmental repository server (repos.cs.kuleuven.be) but research groups might have their own repository server(s) as well.

Using CVS/Subversion/Git

Follow the links for more information about using CVS, using Subversion and or using Git.

SSH to Remote Repositories

Some CVS and/or Subversion tools by default use an rsh connection to connect to remote repositories. rsh connections to departmental machines are deprecated and are certainly not possible from the Internet. Configure the tools to use an ssh connection. You can access most departmental systems from anywhere in Belgium and some from anywhere in the world via ssh. Repository servers are accessible via ssh from anywhere in the world, but on a special non-standard port.

Tip:

    When using a repository server you must connect using a key pair, password authentication is not allowed/possible. But also when using a repository in your home directory, it is probably best to setup ssh using a key pair because you can then use an ssh key-agent such that you can establish ssh connections without having to give your password or passphrase each time. Some GUI clients don't like or are unable to ask for such a password/passphrase when connecting.
    You can create an ssh key with the ssh-keygen command: ssh-keygen -t rsa -b 2048
    Read here for more information about ssh, ssh keys and ssh key-agents.
    It is probably also best to use a command line version of ssh ... on Windows you might like the plink tool that comes with PuTTY, or the ssh for which LUDIT has a Campus License
Notice:
    When using Subversion with SSH, in some circumstances you will notice a message Killed by signal 15. This message is completely innocent and harmless and is caused by a specific combination of the versions of subversion and ssh. You can read more about this in Debian bug #366391

HowTo:

  • Because our repository servers have configured the ssh service on a non-standard port, you need to specify that port:
    (replace the italic parts by the `real' values)
    • for CVS, there are 2 alternatives:
      1. create a wrapper script for ssh, in which (the real) ssh is called with the right arguments:
          #!/bin/bash
          exec ssh -p 2222 "$@"
        and then assign this wrapper script to the CVS_RSH variable:
        • $ export CVS_RSH=ssh-p2222
      2. create an ssh config file as described below

      and then use it as :ext:user@server:/repos/repository in either the -d command line option or the CVSROOT environment variable.

    • for GIT, there are also 2 alternatives:
      1. create an ssh config file as described below and then use it as git clone ssh://user@server/repos/repository
      2. or specify the port explicitly on the command line as in git clone ssh://user@server:2222/repos/repository

    • for Subversion, there are 3 possible ways of doing so:
      1. $ export SVN_SSH=ssh -p 2222

        and then use it as svn+ssh://user@server/repos/repository

      2. as described on http://svnbook.red-bean.com/en/1.5/svn.serverconfig.svnserve.html#svn.serverconfig.svnserve.sshauth:
        create an svn config file (~/.subversion, /etc/subversion/config or equivalent) with contents:
          [tunnels]
          someLabel = $someEnvVar ssh -p 2222
          

        then use it as svn+someLabel://user@server/repos/repository

      3. create an ssh config file as described below and then use it as svn+ssh://user@server/repos/repository

      In our opinion, the second approach is the most elegant one because it keeps the special configuration where it belongs: with the Subversion command and with only that specific server. The other solutions are too general: the specified configuration might hinder other tools that use ssh and/or Subversion as well.

      As a matter of fact, we have configured the machines under our administration in this way in /etc/subversion/config ... so if you are working on a departmental-administered machine and you want to access a Subversion repository on a departmental repository server, you do not need to change some configuration file, but only need to use it as:

      • svn+repocs://user@server/repos/repository


      If you have to use a Microsoft Windows machine, you can find some help here ... courtesy of some fellow Microsoft Windows users, for which many thanks.

    • to use ssh configuration to specify the specific port 2222 on which our repository server(s) are available, create an ssh config file (~/.ssh/config, /etc/ssh/ssh_config or equivalent) with contents:
        host server
                port 2222
        
      and then go on using ssh as you would otherwise.
  • Repositories in your home directory can be accessed via ssh on the normal ssh port. This makes configuration a bit easier, but not all departmental machines can be reached from anywhere in the world.
    • for CVS, set the environment variable:
      • export CVS_RSH=ssh

      and use it as :ext:user@server:/path/to/your/repository in either the -d command line option or the CVSROOT environment variable.

    • for Subversion, just use it as svn+ssh://user@server/path/to/your/repository.

Relocating Repositories

When a repository is moved to another location, you need to take care that your local checked out version stays in sync/connected with/to it.

Most probably, the safest way to do this is:

  • commit all local changes to the repository before it is moved
  • delete your local version
  • check it out again after the repository is moved

For CVS, it seems the above recipe is the only way (unless you are adventurous enough to manually edit all CVS meta-files in your local checked out version and change the repository location yourself ;-)

    Some CVS users report that the following recipe works on an existing checkout/working directory:
      cd your-working-checkout-directory
      for i in `find . -name Root`; do echo :ext:USER@repos.cs.kuleuven.be:/repos/XXX > $i; done
    Change the USER and XXX to your needs of course ;-)

For Subversion, you can also use the --relocate option as described on http://svnbook.red-bean.com/en/1.5/svn.ref.svn.c.switch.html ... in our configuration that will most probably look something like:

    svn switch --relocate svn+ssh://user@oldserver.cs.kuleuven.be/cvs/XXX \
    	svn+repocs://user@repos.cs.kuleuven.be/repos/XXX .

Notice that the above line is wrapped ... it should be executed as a single command and moreover in the top directory of your working checkout directory.

Notice also the use of svn+repocs:// to denote the (new location of the) repository ... more info about this can be found in the section about using SSH to access remote repositories.