CSE 121B: JavaScript Language

Setup: Git Installation

Overview

Git is a version control software framework that will run behind the scenes, tracking your additions, updates, and deletions to your project files and folders. You will use git to commit files to your tracked projects and push/upload your work to your GitHub, remote repository.

If you already have Git installed on your system, you are good to go. To check if you have the latest version of Git installed, open up your command line inferface (CLI) and run git --version

Instructions

Watch: 🎦 What is Git?

Install Git on your computer

Select only one of the following instruction sets depending on your operating system of Windows, Mac, or Linux.

Windows Users
  1. Before downloading Git, check to make sure you don't already have Git installed on your computer.
    1. Open a command prompt by clicking the Start button and typing cmd in the search box. You should get the command prompt terminal to open.

      Alternatively, in VS Code, you can use the terminal panel to complete any command line task. use the Ctrl+` keyboard shortcut to toggle the terminal panel.

    2. Enter the following command and then press Enter:
      git --version
    3. If you see a version number, you already have Git installed. If you don't see a version number, you need to install Git.
  2. To install Git for Windows. Go to git-scm.com/downloads and select Download for Windows.
    An .exe file will be downloaded.
  3. Double click that .exe file to open and run the installation executable. The process of installing Git will start.
    1. Allow the installer to make changes to your computer.
    2. Click Next through all of the setup windows, leaving all the defaults. There will be many windows.
    3. The last window will let you click Install and then click Finish.
  4. Open up a new Command Prompt window by closing the first Command Prompt window and start a instance by clicking the Start button and typing cmd in the search box.
  5. Enter the git --version command and then press Enter to see if Git is installed. You should see the version number.
  6. While we are still in the Command Prompt, we will type in two more commands to set up our username and email that are associated with our GitHub account. Again, it doesn't matter what the path prompt is. These are global settings so you can type them from any path prompt.
    Make sure you use your own username and email between the "" quotes. Use the username and your email you used for the GitHub account. It will be different for everyone.
    1. Type in this command to set the global git username:
      git config --global user.name "yourusername"
      and click Enter. Nothing will happen if you did it right. If you get an error, you need to fix it.
    2. Enter this command to set the email:
      git config --global user.email "youremail@"
      Nothing will happen if you did it right. If you get an error, you need to fix it.
Demonstration: 🎦 Windows Git Installation
macOS Users
  1. Before downloading Git, check to make sure you don't already have Git installed on your computer.
    1. Select the Search icon (it looks like an magnifying glass) on your screen near the top right of your screen.
    2. Type in "Terminal" and open the Terminal application. It doesn't matter what path our command prompt is showing. All the commands we type will work anywhere.
    3. Type in git --version at the prompt and click Enter.
    4. You should now either see a git version number come up or a pop up window that says something about 'The git command requires the command line developer tools ...'. If you have a version number come up, you already have git installed and you don't need to install it. (But you will want to set your config setting as shown below.) If you get the pop-up message, click Install and Agree.
    5. The installation may take quite a few minutes. You will get a set of development tools, which includes Git.
    6. Type in git --version at the prompt and click Enter. You should now see the version number.
    7. While we are still in the command prompt, we will type in two more commands to configure our username and email that are associated with our GitHub account. Again, it doesn't matter what the path prompt is. These are global settings so you can type them from any path prompt.
      Make sure you use your own username and email between the "" quotes. Use the username and your email you used for the GitHub account. It will be different for everyone.
      1. Type in this command to set the global git username:
        git config --global user.name "yourusername"
        and click Enter. Nothing will happen if you did it right. If you get an error, you need to fix it.
      2. Enter this command to set the email:
        git config --global user.email "youremail@"
        Nothing will happen if you did it right. If you get an error, you need to fix it.
    8. If you want to check the global configurations, you can always type
      git config --list
      and you can see the user.name and user.email should have your new username and email values. Don't worry about all the other configurations.
Demonstration: 🎦 Git Install for Mac
Linux Users
  1. Guide: Linux Git Install
  2. Install Git with the link above and then follow the last few steps from the Windows or Mac instructions to set up your global config username and email settings to match your GitHub account.