Installing Git

Git is open source, free, and is available for easy installation on a range of operating systems, including Windows, macOS and Linux.

You will need to have installed the command line version control tool "git". The instructions below tell you how to install it on each of these platforms.

Windows

Please install git (which can be downloaded for free) by downloading an installer from here (this is from the official git website).

Once you have downloaded the installer, double click on the downloaded file to execute it. This will start the installation process. Follow the instructions of the installer (click "Next" to accept the license etc.).

Make sure that everything associated with Git Bash is enabled, and "Use Git from Git Bash only" is selected. This is the safest choice, as it will install a Git Bash command window, which will have everything set up for running Git. We will use Git Bash in this workshop.

To start the program you need to find Git Bash. When you start Git Bash it will open a command window in which you can type commands.

All of these instructions are demonstrated on this (external) video.

Linux

Please install Git using your package manager, e.g. following the instructions here.

The exact command you type will depend on your Linux distribution. Typically, the command will look like apt-get install git, or yum install git, or dnf install git.

If you prefer to build and install from source, there are tarballs available on kernel.org.

macOS

On macOS, you have several choices for how you install git.

  1. You can use the git that is installed as part of Xcode (Apple's free development environment that is supplied as a separate download for macOS). The best way to install this is via Xcode on the Mac App Store. Note that Xcode is a very large download, and installation will take a while.

  2. Install git by going to the official git website and choose macOS. There are instructions here to install via homebrew (via brew install git) or links to download a binary installer.

Starting Git

Once you have installed git, you now need to start a command window. On Windows, you do this by starting Git Bash. On Linux or macOS you need to open a command window (e.g. also called a "terminal", "bash window", "console").

To check that git is working, please type the following in the command window and press return;

git --version

This should run the git command, and will print the version number of git to the screen. For example, on my Mac, I see this printed;

git version 2.24.3 (Apple Git-128)

Don't worry if you see something slightly different. The exact version number and format of this output will depend on how you installed git. If you see something like this printed;

command not found: git

then that means that git is not installed, or something is wrong. Please go through the installation instructions again and double-check you have followed all steps.

Commands used in this workshop

We will be using the command window for this workshop. It provides the quickest way to use git. More importantly, you will learn how git works. There are a very small number of git commands. Once you've learned them, it makes it much easier to use and understanding what a graphical git interface is doing. Through this workshop we will build up a git command cheat sheet that you can always refer back to.

In addition to some git commands, we will also be using a very small number of additional commands that will need to be typed into the command window. These are;

Choosing a text editor

We will also need to use a text editor. A text editor is a program that lets you create and edit simple text files. There are many different text editors available. You are free to choose the one you like the best. Commonly-installed text editors include;

Note that we are using a text editor to make it easier to run the workshop. Git can be used to version control all kinds of files produced using all kinds of programs. For example, you could version control Word documents, PDFs, Excel spreadsheets and photos. In this workshop, we will just work with text files.