Computer Science Grade 9 20 min

3. Installing and Configuring Git

Guide students through the process of installing and configuring Git on their computers.

Tutorial Preview

1

Introduction & Learning Objectives

Learning Objectives Install Git on their specific operating system (Windows, macOS, or Linux). Verify a successful Git installation using the command line. Configure their global Git username and email address. Explain the purpose of the global `.gitconfig` file. Set a default text editor for Git commit messages. Check their current Git configuration settings from the command line. Ever accidentally deleted a file and wished you could go back in time? ⏳ What if your code had its own time machine? In this lesson, you'll set up the essential tool that programmers use to track changes in their code: Git. We'll walk through installing it on your computer and setting it up with your personal information, getting you ready to start your first project. Real-World Appli...
2

Key Concepts & Vocabulary

TermDefinitionExample GitA free, open-source distributed version control system. It's like a 'save' button for your entire coding project, but it keeps a detailed history of all your saves.After installing Git, you can use it to track every change in your Python game project, from adding a new character to fixing a bug. Command Line Interface (CLI)A text-based way to interact with your computer by typing commands. Programmers use it to give instructions directly to tools like Git.Opening the Terminal on macOS or Command Prompt on Windows and typing `git --version` to talk to Git. Configuration (`.gitconfig`)A file where Git stores your settings, like your name and email. This file tells Git who is making changes to the code.When you set your username, Git writes `name = You...
3

Core Syntax & Patterns

Verifying Installation git --version Run this command in your terminal or command prompt after installation to check if Git is installed correctly and see which version you have. Setting Global Identity git config --global user.name "Your Name" git config --global user.email "your.email@example.com" These are the two most important commands to run after installing Git. They set your identity for every change you make on your computer. The `--global` flag makes it apply to all your projects. Checking Configuration git config --list Use this command to see all your current Git settings. It's a great way to double-check that you've set your name and email correctly.

4 more steps in this tutorial

Sign up free to access the complete tutorial with worked examples and practice.

Sign Up Free to Continue

Sample Practice Questions

Challenging
You are setting up a public computer in a school lab for multiple students to use. To ensure each student's work is credited to them, you want to force them to configure their identity for every new project they start. What is the most effective way to achieve this?
A.Run `git config --global user.name "Student"` and `git config --global user.email "student@school.org"`.
B.Deliberately avoid running any `git config --global` commands for `user.name` and `user.email`.
C.Set the global `.gitconfig` file to be read-only so no one can change the global settings.
D.Install a special version of Git designed for schools.
Challenging
An automated setup script contains the line: `git config --global user.name $FULL_NAME`. If the environment variable `$FULL_NAME` contains the value "Jean Grey", why is this command likely to fail and how should it be fixed?
A.It will fail because environment variables cannot be used; it should be fixed by hardcoding the name.
B.It will fail because of the space in "Jean Grey"; it should be fixed by changing the variable to `$full_name`.
C.It will fail because of the space in "Jean Grey"; it should be fixed by enclosing the variable in quotes: `"$FULL_NAME"`.
D.It will fail because `user.name` is not a valid key; it should be fixed by using `user.fullname`.
Easy
After successfully installing Git, which command should you use to check if it's ready to use and to see its version number?
A.git status
B.git --version
C.git check
D.git install --verify

Want to practice and check your answers?

Sign up to access all questions with instant feedback, explanations, and progress tracking.

Start Practicing Free

More from III. Introduction to Version Control with Git

Ready to find your learning gaps?

Take a free diagnostic test and get a personalized learning plan in minutes.