The folder beginner contains the exercises for the C2SM Git Workshop "Git for Beginners".
The folder advanced contains the exercises for the C2SM Git Workshop "Git for Advanced".
To run this course on your computer, the following things need to be set up:
- Git
- SSH key linked to your GitHub account
- Python
- JupyterLab (Beginner's course only)
- Final check (Advanced course only)
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.
- Enable the Windows Subsystem for Linux (WSL) feature on your Windows machine by following the steps here.
- Install a Linux distribution of your choice from the Microsoft Store. We recommend using Ubuntu 22.04.3 LTS.
- Open the Start menu and search for "Ubuntu" to launch the distribution.
- 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.
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.
- Create your own GitHub account (if not yet available)
- Generate an SSH key.
- Add your SSH key to GitHub.
To install Python, we recommend the instructions from Real Python, but of course many other instructions will do as well.
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 [email protected]: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
Check if everything is set up correctly by following the steps below from a Linux shell.
- Step 1: Download the file check_requirements_advanced.sh.
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!