Install Git#

Git is a version control system that is designed to track changes in files stored within repositories. GitHub offers a platform for storing and collaborating on various Git repositories.

Caution

Installing Git requires administrator access to your computer.

Mac & Linux#

Terminals come pre-installed with Git so there are no steps required to install Git.

To launch terminal, go to Spotlight Search or Applications and find the Terminal app to open.

../_images/git_launch1_macOS.png

Windows#

Git can be installed in two different ways on Windows. The first is through using Windows’ command-line interface (CLI). The second is by downloading the Windows installer with a graphical user interface (GUI).

If this is the first you install Git, we recommend using the GUI installer to see where Git will be installed on your computer and to easily select the settings specific to your Git software.

Install using CLI#

Git may be installed using a CLI as long as the user has the winget tool (installed by-default on Windows 10 and Windows 11), can access the internet, and have a CLI like Windows Powershell or Command Prompt (should be available by default). We will be using Windows Powershell in the screenshots below.

  1. Launch your CLI and enter the command below:

    winget install --id Git.Git -e --source winget --custom '/o:Components=ext,gitlfs,assoc,assoc_sh /o:EditorOption=Nano /o:SSHOption=OpenSSH /o:CurlOption:OpenSSL /o:BashTerminalOption=MinTTY'
    
../_images/winget_git_setup1.png
../_images/winget_git_setup2.png
  1. You will be prompted for administrator password and winget will proceed to download and install Git

../_images/winget_git_setup3.png

Note

The command provided above installs Git with the same settings as the GUI install explained in the section below. If you want to install with different settings, you can refer to this guide to configure the settings.

A command commonly found online is winget install --id Git.Git -e --source winget

Install using GUI#

Download and run the Windows installer (the .exe file).

After double-clicking the installer, you will first be prompted to enter your administrator password. Follow the steps below:

  1. Read the license and click “Next” to continue

../_images/git_setup1_windows.png
  1. Install Git in the default location

../_images/git_setup2_windows.png
  1. Leave the default components selected

../_images/git_setup3_windows.png
  1. Select the default Start Menu folder

../_images/git_setup4_windows.png
  1. Change the default editor used by Git to nano which is a simpler alternative to vim

../_images/git_setup5_windows.png
  1. Override the default branch name for new repositories to be “main”

../_images/git_setup6_windows.png
  1. Select “Git from the command line and also from 3rd-party software”

../_images/git_setup7_windows.png
  1. Select “Use the OpenSSL library” as the HTTPS transport backend

../_images/git_setup8_windows.png
  1. Select “Checkout Windows-style, commit Unix-style line endings”

../_images/git_setup9_windows.png
  1. Use MinTTY as the terminal emulator to use with Git Bash

../_images/git_setup10_windows.png
  1. Select “Fast-forward or merge” as the default behavior for git pull

../_images/git_setup11_windows.png
  1. Select “Git Credential Manager”

../_images/git_setup12_windows.png
  1. Select “Enable file-system caching” and click “Install.” Git will now begin to install and show a progress bar.

../_images/git_setup13_windows.png
  1. Click “Finish” once installed

../_images/git_setup14_windows.png

Note

If there are any Git installation steps not covered in the instructions above, we recommend using default settings or using other online tutorials as found on Hostman, PhoenixNAP, or How-To Geek.

Post-installation#

Git provide users with a new “Git Bash” terminal that is useful for setting up the conda environments and interacting with the tutorial repository, because it allows using commands such as cd and ls.

To launch Git Bash, go to the search bar in the Windows task bar and type “Git Bash.”

../_images/git_launch1_windows.png

When the Git Bash app appears, open it to launch Git Bash terminal.

../_images/git_launch2_windows.png