Skip to content

C2SM/git-course

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C2SM Git Courses

Git Course for Beginners

The folder beginner contains the exercises for the C2SM Git Workshop "Git for Beginners".

Git Course for Advanced

The folder advanced contains the exercises for the C2SM Git Workshop "Git for Advanced".

Getting Started

To run this course on your computer, the following things need to be set up:

  1. Git
  2. SSH key linked to your GitHub account
  3. Python
  4. JupyterLab (Beginner's course only)
  5. Final check (Advanced course only)

1. Installing Git on your Computer

To follow the course, Git needs to run on a Linux or MacOS terminal. Windows users can either follow the instructions below to install Ubuntu or use a Linux server they have access to.

Important note: You must have at least Git 2.28 (released 27 July 2020) installed. You can check your Git version by typing git --version in your terminal.

Mac and Linux users: To install Git on your computer, please follow the instructions to Install Git on Mac or Install Git on Linux

Windows users: Please follow the instructions below to install Ubuntu under Windows. Afterwards, please follow the Install Git on Linux instruction.

Instructions for Windows Users

We recommend to install the Windows Subsystem for Linux 2 (WSL2). Using Git with WSL2 provides a better terminal experience for Windows users. With WSL2, you can access a Linux terminal directly from Windows, which makes it easier to work with Git commands and other Linux-based tools. This also allows for more flexibility in managing and running scripts, as well as better compatibility with Linux-based workflows. Additionally, WSL2 provides a more secure environment for Git operations by isolating them from the Windows operating system.

Setting up WSL2

  1. Enable the Windows Subsystem for Linux (WSL) feature on your Windows machine by following the steps here.
  2. Install a Linux distribution of your choice from the Microsoft Store. We recommend using Ubuntu 22.04.3 LTS.
  3. Open the Start menu and search for "Ubuntu" to launch the distribution.
  4. Follow the prompts to set up a username and password for the Ubuntu distribution.

Congratulations! You have now an Ubuntu environment and can work in the same way as on a Linux machine.

2. Creating a GitHub Account and SSH key

Having a GitHub account allows you to collaborate on open-source projects and store your own code in the cloud. With an SSH key, you can securely connect to GitHub without having to enter your username and password every time you push or pull code, which makes the process faster and more convenient. It also adds an extra layer of security to protect your GitHub account from unauthorized access.

Instructions

3. Installing Python

To install Python, we recommend the instructions from Real Python, but of course many other instructions will do as well.

4. Installing JupyterLab (Beginner's Course only)

For the beginners course, you also need some non-standard Python packages, namely:

  • jupyterlab
  • bash_kernel

To install these two packages, run the following commands in your terminal.

If you have set up your SSH key, clone this Git repository by using the SSH protocol:

git clone git@github.com:C2SM/git-course.git

Otherwise, use the HTTPS protocol:

git clone https://github.com/C2SM/git-course.git

Navigate into the cloned repository:

cd git-course

Create a new Python virtual environment named git-course_env:

python -m venv git-course_env

Activate the newly created virtual environment:

source git-course_env/bin/activate 

Install the required Python packages specified in the requirements.txt file:

pip install -r requirements.txt 

Install Bash kernel for Jupyter notebooks:

python -m bash_kernel.install

To be able to access directories outside of the git-course repository in JupyterLab, you need to navigate out of the repository BEFORE launching JupyterLab:

cd ..

Finally, you can start with the exercises by running:

jupyter lab

This command will open the JupyterLab interface in your browser. If it does not open automatically, you will need to copy and paste the URL manually. In this case, please follow the instructions on your terminal.

If you are not able to start JupyterLab for some reason, you can try to launch a Jupyter Notebook, which provides a simpler user interface:

jupyter notebook

5. Final check (Advanced course only)

Check if everything is set up correctly by following the steps below from a Linux shell.

curl -O https://raw.githubusercontent.com/C2SM/git-course/main/check_requirements_advanced.sh
  • Step 2: Make the file executable.
chmod +x ./check_requirements_advanced.sh
  • Step 3: Run the script from a Linux shell.
./check_requirements_advanced.sh

Have fun!