Installation instructions

For this workshop, you will need:

  1. a supported web browser,
  2. an account at gitlab.com, and
  3. installation and configuration of git.

Please make sure to follow the instructions below to install and configure Git before the workshop.

Important!

  • Make sure to create an account at gitlab.com, if you don't have one already. Basic Gitlab accounts are free.
  • Just installing git is not enough: you have to configure it, too. See below, otherwise you will start off behind! Then, verify it (trust us on this).

Step 1: The Bash Shell

Bash is a commonly-used shell that gives you the power to do tasks more quickly.

For Windows:

  1. Download the Git for Windows installer.
  2. Run the installer and follow the steps below:
    1. Click on “Next” four times (two times if you’ve previously installed Git). You don’t need to change anything in the Information, location, components, and start menu screens.
    2. From the dropdown menu select “Use the Nano editor by default” (NOTE: you will need to scroll up to find it) and click on “Next”.
    3. On the page that says “Adjusting the name of the initial branch in new repositories”, ensure that “Let Git decide” is selected. This will ensure the highest level of compatibility for our lessons.
    4. Ensure that “Git from the command line and also from 3rd-party software” is selected and click on “Next”. (If you don’t do this Git Bash will not work properly, requiring you to remove the Git Bash installation, re-run the installer and to select the “Git from the command line and also from 3rd-party software” option.)
    5. Ensure that “Use the native Windows Secure Channel Library” is selected and click on “Next”.
    6. Ensure that “Checkout Windows-style, commit Unix-style line endings” is selected and click on “Next”.
    7. Ensure that “Use Windows’ default console window” is selected and click on “Next”.
    8. Ensure that “Default (fast-forward or merge) is selected and click “Next”
    9. Ensure that “Git Credential Manager Core” is selected and click on “Next”.
    10. Ensure that “Enable file system caching” is selected and click on “Next”.
    11. Click on “Install”.
    12. Click on “Finish” or “Next”.
  3. If your “HOME” environment variable is not set (or you don’t know what this is):
    1. Open command prompt (Open Start Menu then type cmd and press Enter)
    2. Type the following line into the command prompt window exactly as shown:

      setx HOME "%USERPROFILE%"

    3. Press Enter, you should see SUCCESS: Specified value was saved.
    4. Quit command prompt by typing exit then pressing Enter

This will provide you with both Git and Bash in the Git Bash program.

You can also follow this video tutorial

For MacOS:

  • The default shell in some versions of macOS is Bash, and Bash is available in all versions, so no need to install anything. You access Bash from the Terminal (found in /Applications/Utilities).
  • See the Git installation video tutorial for an example on how to open the Terminal. You may want to keep Terminal in your dock for this workshop.

  • To see if your default shell is Bash type echo $SHELL in Terminal and press the Return key. If the message printed does not end with ‘/bash’ then your default is something else and you can run Bash by typing bash

  • If you want to change your default shell, see this Apple Support article and follow the instructions on “How to change your default shell”.

  • You can also follow this Video Tutorial

For Linux:

  • The default shell is usually Bash and there is usually no need to install anything.

  • To see if your default shell is Bash type echo $SHELL in a terminal and press the Enter key. If the message printed does not end with ‘/bash’ then your default is something else and you can run Bash by typing bash.

Step 2: Git installation

Git is a version control system that lets you track who made changes to what when and has options for easily updating a shared or public version of your code on github.com, gitlab.com or bitbucket.org.

For Windows:

For MacOS:

For macOS, install Git for Mac by downloading and running the most recent “mavericks” installer from this list. Because this installer is not signed by the developer, you may have to right click (control click) on the .pkg file, click Open, and click Open on the pop up window. After installing Git, there will not be anything in your /Applications folder, as Git is a command line program. For older versions of OS X (10.5-10.8) use the most recent available installer labelled “snow-leopard” available here.

You can also follow the following Video Tutorial

For Linux:

Please also verify your installation and configure Git.

If Git is not already available on your machine you can try to install it via your distribution package manager.

For Debian/Ubuntu run:

$ sudo apt-get install git

Check the version after installing:

$ git --version

For Fedora:

$ sudo dnf install git

Please also verify your installation and configure Git.

Step 3: Git configuration

  • Using your GitLab account at gitlab.com and having installed Git on your machine, you should go through the following steps to configure Git.

First, the following commands will set your user name and email address:

$ git config --global user.name "Your Name"
$ git config --global user.email username@gfz-potsdam.de

This is important since your Git commits use this information. The --global option ensures that you do not need to enter this information again on your machine.

It is important to set also the default text editor to use with Git. You can replace nano with vim, emacs or any other editor of your choice:

$ git config --global core.editor nano

If you use Atom as editor, set:

$ git config --global core.editor "atom -nw"

If you are on Windows and want to use Notepad or Notepad++, you can configure this by providing the full path to the executable and optionally set some options. For example (adjust the path if needed, and note the quotation):

$ git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"

To see where this information is stored (--show-origin works on git version 2.8.0 or greater only), use:

$ git config --list --show-origin

You can also choose a different text editor of your choice, following this table:

Editor Configuration command
Atom $ git config --global core.editor "atom --wait"
nano $ git config --global core.editor "nano -w"
BBEdit (Mac, with command line tools) $ git config --global core.editor "bbedit -w"
Sublime Text (Mac) $ git config --global core.editor "/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -n -w"
Sublime Text (Win, 32-bit install) $ git config --global core.editor "'c:/program files (x86)/sublime text 3/sublime_text.exe' -w"
Sublime Text (Win, 64-bit install) $ git config --global core.editor "'c:/program files/sublime text 3/sublime_text.exe' -w"
Notepad++ (Win, 32-bit install) $ git config --global core.editor "'c:/program files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"
Notepad++ (Win, 64-bit install) $ git config --global core.editor "'c:/program files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"
Kate (Linux) $ git config --global core.editor "kate"
Gedit (Linux) $ git config --global core.editor "gedit --wait --new-window"
Scratch (Linux) $ git config --global core.editor "scratch-text-editor"
Emacs $ git config --global core.editor "emacs"
Vim $ git config --global core.editor "vim"
VS Code $ git config --global core.editor "code --wait"

It is possible to reconfigure the text editor for Git whenever you want to change it.

Step 4: Git installation verification

  1. Create a new example folder, step into it, then create a file example.txt:

  2. Initialize a repository and stage the new file:

$ git init
$ git add example.txt
  1. Commit the change, this should open the editor which you have configured, in there add an example commit message:
$ git commit example.txt
  1. Finally try:
$ git log

If you see now something line this (different name, email, and commit message), your Git is configured for the workshop:

$ git log

commit commitId (HEAD -> master)
Author: Author info (name and email address)
Date:   time and tade of the commit

    making a test commit

Setting up SSH keys

Using the SSH protocol, you can connect and authenticate to remote servers and services. With SSH keys, you can connect to GitLab without supplying your username or password at each visit. You can follow this link to set it up

If you are unsure about this, you can skip this part and authenticate with GitLab using your username and password every time you will push changes to GitLab.