CSE 373, Spring 2019: Git Introduction and Installation

What is Git?

Git is a version control system (VCS): a tool for tracking changes between versions of code and sharing those changes with other people. A VCS allows you to not only see changes from old code, but also revert back to older versions or create alternate versions, which you can later merge back together.

Git is one of the most widely-used VCSs; this is due in part to its flexibility, but its surrounding ecosystem also plays a large role in its popularity: many of you who aren't familiar with VCSs have still probably heard of GitHub, which has become a leading platform for open-source projects.

So, what is GitHub? GitHub is essentially a website that provides servers for Git repositories (repos). In the context of VCSs, a repository is a copy of your code and its history—it's a data structure representing your project. When working with multiple users in a Git project, each user has their own copy of the code repository on their machine. To share code, all users sync their local repositories with a single remote repository on some server—these repositories are what GitHub provides.

Now that we've gotten that introduction out of the way, we won't actually be using GitHub in this class. Instead, we'll be using GitLab, a Git-repository hosting service similar to GitHub, but open source so that it can run on our CSE servers.

Installing Git

Only Windows users should need to install Git manually.

Meanwhile, macOS should come with Git, and Linux operating systems should have easy access to git via the built-in package manager, so this guide is only for Windows. (If you're using Linux, we'll assume you know where to look if you need help installing Git.)

Note that most of the options in this process don't matter for this class. The screenshots in the walkthrough below show settings for one example installation, but you may choose other options unless we explicitly state otherwise in the steps below. Additionally, if there are any screens or settings in the installer that are not included in this guide, leaving those settings default should be fine (alternatively, you may apply common sense to choose those options).

  1. Download and run the Git for Windows installer from this page.

  2. Accept the license by clicking "Next >".

  3. On the next screen, choose any additional components you want, or just leave them default. None are required for the class, but none take any significant disk space, so it's fine to do whatever.

  4. On the next screen, you can choose a default text editor for Git. We won't need to run Git from command line, so Git should never actually use this setting, so it's again safe to select anything here; if you don't have any of the listed programs installed already, we recommend just selecting the one for Nano.

  5. On the next screen, choose which Git tools will be available from command line. We strongly recommend you choose the default option, as shown below:

  6. On the next screen, choose an HTTPS backend. This choice shouldn't matter, so the default is fine.

  7. On the next screen, choose how line endings will be treated. We strongly recommend choosing the default option, since anything else will likely produce formatting errors between operating systems.

  8. On the next screen, choose which terminal emulator Git Bash will use. The two options have slightlly different behaviors and configuration options, but both are functional, so it doesn't matter which you choose here.

  9. The last screen presents some more miscellaneous options. There isn't much reason to disable any of these, so you can just leave them enabled (or disable them if you want.)

  10. Afterwards, click "Install", and the installer should install Git. When it finishes, you can close it without starting Git Bash or viewing the README file.