skip to content

git

What is git?

git is a tool for version control of files and projects. In particular, version control systems (VCS) are used in team or individual software development. They allow multiple parties to work on a project simultaneously through the "copy-modify-merge" model and provide convenient versioning so that you can jump back to any point in the development process at any time. Git has some unique features, especially because it is a distributed VCS, which means that each developer typically has a local repository that they can synchronize with other repositories on the network.

How do I use git?

git is available in the package sources of almost all popular Linux distributions, as well as many other Unix-like operating systems (such as macOS, Solaris, and BSD). There are also graphical user interfaces, such as gitk. On Windows, you need to download and install the free software msysgit. For those who use Subversion with the TortoiseSVN client, the Tortoisegit project may also be of interest.

Setting up repositories is very simple. Git also has an incredible number of possibilities and corresponding commands that cannot be explained in detail here. Therefore, we refer you to existing short overviews, tutorials, or books on the internet, for example:

 

git at the RRZK

git is available for immediate use on the central user server "dialog.rrz.uni-koeln.de" at the RRZK, which can be used by all owners of a student or staff account via SSH. The server is only accessible within the university network UKLAN, for access from outside please establish a VPN connection previously.

For projects in which teams are to work with a git repository, the use of the project management software Redmine with integrated git is recommended. In this case, the project responsible can restrict access to the git repository in a particularly simple way.

Git can be used as part of a web presence, an offline project, or in the home directory of each account. Here is a short example of how to set up and synchronize a local repository and one on dialog.

Simple example (with Linux)

  1. Creating the network repository on dialog:

    ssh YourAccount@dialog.rrz.uni-koeln.de
    mkdir superprojekt
    cd superprojekt
    git init --bare
    exit
     

  2. Cloning the network repository into a local repository (directory "/home/user/superproject"):

    cd git clone ssh://YourAccount@dialog.rrz.uni-koeln.de/~/superprojekt

    (Note: The warnings that an empty repository has been cloned can be ignored)
  3. Setting global variables if necessary (one-time only):

    git config --global --add user.name "Patrick Holz"
    git config --global --add user.email "patrick.holz@uni-koeln.de"

  4. Creating a file and adding it to the index:

    cd ~/superprojekt
    touch mytest.txt
    git add mytest.txt

  5. Editing the file and transferring it to the local repository:

    echo Testtext >> mytest.txt
    git commit -a -m "Testtext added"

  6. Transferring changes to the network repository:

    git push origin master

As said before, this is a very simple example that does not in any way highlight the advantages of git, as these only become apparent when dealing with topics such as branches, diffs, merges, patches, and commits. However, it shows how to work with git on our servers in general.

Contact
If you have any questions or problems, please contact the RRZK-Helpdesk