Skip to content

GitLab first step

GitLab is an open-source-software to host and manage git repositories. GitLab serves the main task of the code-management. In addition to the main task of reviewing the code, other functionalities such as issue tracking, kanban board, and wiki page are provided to organize a collaborative workflow. GitLab thus supports developers in increasing the quality of the programming language development.


Sign in and Log in

KIT members can sign-in via Federated Login Service of bwIDM, which provides user identification using openID connection.

  1. To link your KIT account to GitHub, please click the FeLS - Federated Login Service button

    alt text

  2. You are now redirected to the Federated Login Service page. Please find "Karlsruhe Institute für Technologie" or "KIT" in search filter, and select PROCEED. FeLS provides KIT Login session to you.

    alt text

  3. The Federated services at KIT redirected you to shibboleth identity serviceprovider page, which is located on the KIT-SCC server. Please login using your KIT-Account (z.B. ab1234 as employee, uxxxx as student) and the corresponding credential.

    alt text

Note: You can only create projects and groups in GitLab if you log in for the first time after verifying vis Fels (OIDC)


Connection to KIT-GitLab

Git is a distributed version control system. Version control refers to the process of storing different data during the different phases of a project. This allows developers to keep track the improvement and revert to an earlier phase if they decide to undo some of the changes made. You can work your code development locally, then share or push your changes to the GitLab server i.e. to the original git codebase.

There are two approaches to communicate with GitLab resource:

Note: Most supported OmniAuth 2.0 providers don’t support git over HTTPs password authentication. As a workaround, you can authenticate using a personal access token.


1. SSH connection using SSH keys

GitLab uses the SSH protocol to securely communicate with Git. When you use SSH keys to authenticate to the GitLab remote server, you don’t need to supply your username and password each time. To link the project with ssh connection including key, please follow this procedure:

  1. create ssh keys in your local machine.

    ssh-keygen -t ed25519 -C "<comment>"
    
  2. configure your SSH setting for host connection from the file ~/.ssh/config in your local.

    # KIT GitLab instance
    Host gitlab.kit.edu
        PreferredAuthentications publickey
        IdentityFile ~/.ssh/id_ed25519
    

The storing SSH keys in GitLab can be found with user setting [https://gitlab.kit.edu/-/profile/keys]. You can add your SSH key by inserting the public part of your SSH key into the input field.

alt text

If you complete to add your keys in your user profile, then you can apply this command to clone your project repository in your local terminal:

git clone git@gitlab.kit.edu/kit/institute/group/project.git

The appropriate name of the desired repository for the SSH connection can also be copied directly using the “Code” button in the GitLab project page. Most modern operating system, Linux / MacOS / Windows, support git application to use command line interface from the shell console.

Please find more detail information about SSH connection under official GitLab documentation page. Use SSH keys to communicate with GitLab


2. HTTPs with Personal Access Token

Alternatively you should use personal access token to clone and push and whatever action in gitlab. If you don't have the possibility to clone your project via SSH protocol, you can access your project via HTTPS instead.

You can find setting for the personal access token on the page [https://gitlab.kit.edu/~/profile/personal_access_tokens]

alt text

  • In the "Name" field, enter a name (for example: My API Token, Test Token...).
  • (Optional) Set an Expiration date. From this date points on, the token created no longer will work.
  • Select one or more scopes. For API access the scope api is sufficient for https access with PAT.
  • Click on "Create personal access token".

The token is now displayed to you for a while.

Important : secure your token, as soon as you leave the page or close the browser, you cannot display the token again.

You can now access git repository in KIT-GitLab with passwordless https connection.

git clone https://<username>:<personal_access_token>@gitlab.kit.edu/kit/group/project.git

You can set your PAT on your GitLab work flow permanently.

  1. open your git configuration file under your home directory

    cat .git/config
    -------------------------------------------------------------------------------------------
    [remote "origin"]
      url =  https://<username>:<personal_access_token>@gitlab.kit.edu/kit/group/project.git
      fetch = +refs/heads/*:refs/remots/origin/*
    
  2. or directly you can set with following command

    git remote set-url origin https://<username>:<personal_access_token>@gitlab.kit.edu/kit/group/project.git
    

You can find more detail information about https connection with PAT under official GitLab documentation page. Clone repository using personal access token


Create your project

To be able to create a project, you must be authenticated using bwIDM. You can create a private project within user namespace. You can also create a project under your organization unit. However, all KIT users should be enable to create a project only after 2rd level of layer in the KIT organization. [KIT organization]

https://gitlab.kit.edu/lastname.firstname/myproject.git
https://gitlab.kit.edu/kit/scc/myproject.git

The most important configurable data are:

  • Project name: name of the project e.g. myproject. It may not contain spaces or special characters.
  • Visibility Level
    • Private : Only you yourself can see the project
    • Internal : All users of the KIT GitLab instance can see the project
    • Public : The project can be viewed worldwide


Create group

https://docs.gitlab.kit.edu/en/organization/#create_group


Git for Windows

Download git for windows: https://gitforwindows.org/

There are several possibilities for using git GUI on Windows.


GitLab Trainings

GitLab serves free trainings https://levelup.gitlab.com/learn/dashboard. These can be attended free of charge.

KIT members can also take part in free training courses on Gitlab via the Helmholtz Cloud (HIFIS) and the HELMHOLTZ Information & Data Science Academy (HiDA). Current offers can be found under Education & Training and in the HiDA Course Catalog..