🚧 Under construction — VoTechWorks is being built. A free tech program — complimentary, as our commitment to get America working.
voTechWorksGrade 13 · a vocational technology learning center, by urbanicity
newSchoolWorks.com › VoTechWorks › Technology & Design › Web & Software Development › Git Version Control for Web & Software Development › Lesson 2
TEC-WEB46-05 · Lesson 2 · 12 clock hours · lab

Installing Git and Configuring the Environment

Objective. Students install Git on a Linux or Windows workstation, configure global user identity and preferred editor, and verify the installation produces a functional git version output.

⚠ Pending professional review

This lesson, its worked examples and its practice questions has not yet been verified by an industry-certified professional or by a certification or approval body. It is a study draft and may contain errors. Do not use it as instructions for work on a job site or on live equipment. Always follow your instructor, your supervising professional, and current official references and regulations.

VoTechWorks program approval and accreditation are still in progress. Credentials are issued only by the certifying bodies named in each program, after their own exams.

Why Version Control Starts with a Proper Setup

Before you write a single line of production code, your environment must be configured correctly. Git is the industry-standard distributed version control system used across virtually every software development workplace. Installing it properly and configuring your identity ensures that every commit you record is traceable, recoverable, and ready for team collaboration.

Installing Git

On Linux

Most Linux distributions ship Git through their native package managers. Open a terminal with sufficient privileges and run the appropriate command for your distribution:

The package manager resolves dependencies automatically and places the Git binaries in your system PATH. After the installation completes, confirm it succeeded:

```

git --version

```

The terminal should return a version string such as `git version 2.x.x`. Record this exact string in your lab log. If the command is not found, the installation did not complete successfully — re-read the output for error messages before continuing.

On Windows

Download the official installer from git-scm.com. During setup, accept the recommended defaults unless your instructor specifies otherwise. The installer adds Git Bash, a POSIX-compatible terminal, along with the core Git tools. After installation, open Git Bash or PowerShell and run `git --version` to verify.

Configuring Your Global Identity

Every commit in Git is stamped with the author's name and email address. This is not optional — without it, some Git workflows refuse to commit. Set your identity globally so it applies to every repository on your workstation:

```

git config --global user.name "Your Full Name"

git config --global user.email "you@example.com"

```

Use the same email address you will register with GitHub so that commits link correctly to your profile.

Choosing a Text Editor

Git opens a text editor whenever you write a commit message or resolve a conflict interactively. Set your preferred editor now:

```

git config --global core.editor nano

```

Replace `nano` with `vim`, `code --wait` (Visual Studio Code), or another editor you are comfortable with. The `--wait` flag tells VS Code to pause Git until you close the file.

Setting the Default Branch Name

Modern Git repositories use `main` as the default branch name. Configure this before you create any repositories:

```

git config --global init.defaultBranch main

```

Verifying Your Configuration

Display all active settings with:

```

git config --list

```

You should see `user.name`, `user.email`, `core.editor`, and `init.defaultBranch` in the output. Copy this output into your lab log and have it signed off by your instructor.

Git stores global settings in a plain text file at `~/.gitconfig` on Linux/macOS and in your user profile folder on Windows. You can read this file directly to inspect or manually edit settings.

Setting Up SSH Authentication for GitHub

Passwords for remote repositories are increasingly deprecated. SSH key-pair authentication is the standard secure method for communicating with GitHub.

Generating a Key Pair

Run the following command in your terminal:

```

ssh-keygen -t ed25519 -C "you@example.com"

```

The `-t ed25519` flag selects a modern, compact elliptic-curve algorithm. When prompted for a file location, press Enter to accept the default (`~/.ssh/id_ed25519`). When prompted for a passphrase, entering one adds an extra layer of protection — this is strongly recommended on shared or lab workstations.

Two files are created: `id_ed25519` (your private key, never shared) and `id_ed25519.pub` (your public key, safe to share).

Adding the Public Key to GitHub

1. Display the public key: `cat ~/.ssh/id_ed25519.pub`

2. Copy the entire output.

3. In your GitHub account, go to Settings → SSH and GPG keys → New SSH key.

4. Paste the public key, give it a descriptive title, and save.

Testing the Connection

```

ssh -T git@github.com

```

A successful response reads: Hi username! You've successfully authenticated, but GitHub does not provide shell access. Log this message verbatim. If authentication fails, check that the correct public key was added and that your SSH agent has loaded the private key (`ssh-add ~/.ssh/id_ed25519`).

Safety and Best Practices

Key terms8

Version Control System (VCS)Software that tracks changes to files over time, allowing developers to recall specific versions, compare differences, and collaborate without overwriting each other's work.
git config --globalA Git command flag that writes a setting to the user-level configuration file (~/.gitconfig), making the setting apply to all repositories on that workstation.
SSH key pairA matched set of cryptographic keys — a private key kept secret on your machine and a public key shared with remote services — used to authenticate without a password.
ed25519A modern elliptic-curve digital signature algorithm recommended for generating SSH keys because it is compact and computationally strong.
Package managerA system tool (such as apt or dnf) that automates the download, installation, and dependency resolution of software packages from trusted repositories.
Default branchThe primary branch created automatically when a new Git repository is initialized; set to 'main' by modern convention using the init.defaultBranch configuration option.
Public keyThe shareable half of an SSH key pair that is uploaded to services like GitHub; it allows the service to verify your identity without ever seeing your private key.
~/.gitconfigThe plain text file in a user's home directory where Git stores global configuration settings such as user name, email, and preferred editor.
In class: Follow a step-by-step installation guide to install Git via the package manager on a Linux VM (apt install git or dnf install git) and verify with git --version; document the installed version in a lab log entry. · Run git config --global commands to set user.name, user.email, core.editor, and default branch name, then use git config --list to confirm all settings and record the output in the lab log. · Generate an SSH key pair using ssh-keygen, add the public key to a personal GitHub account, and test the connection with ssh -T git@github.com, logging the success or troubleshooting steps taken.
Materials: Linux VM or Windows workstation with terminal access, Git installer, GitHub account (free tier), lab log template (digital or printed)
Check: Instructor inspects each student's git config --list output and confirms SSH test returns authenticated successfully; lab log entry signed off by instructor.

Practice check8

Answer each question, then check it. Nothing is recorded; this is your own practice.

CompTIA ITF+ – IT Concepts and Terminology
1. A student runs `git --version` after installation and receives the message 'command not found.' What is the most likely cause?
CompTIA Linux+ – Managing Software and Services
2. Which command installs Git on a Debian-based Linux distribution?
CompTIA Linux+ – Configuring User Environments
3. After installing Git, a developer wants every commit to display their work email address. Which command accomplishes this?
CompTIA ITF+ – IT Concepts and Terminology
4. A student uses `git config --list` and does not see `init.defaultBranch` in the output. What is the likely consequence if they create a new repository without setting this?
CompTIA Linux+ – Security
5. When generating an SSH key pair with `ssh-keygen -t ed25519`, which file must NEVER be shared with GitHub or anyone else?
CompTIA Linux+ – Security
6. After uploading their SSH public key to GitHub, a student runs `ssh -T git@github.com` and receives: 'Permission denied (publickey).' What is the FIRST troubleshooting step?
CompTIA Linux+ – Security
7. A student on a shared lab workstation wants to add a passphrase to their SSH key for extra security. When during the `ssh-keygen` process is the passphrase set?
CompTIA ITF+ – IT Concepts and Terminology
8. A developer wants Git to open Visual Studio Code when writing commit messages. Which command correctly configures this?
Record this lesson on my transcript. Sign in with your key and enrollment email to record lessons (enroll free if you have no key). This page stays open to read and practise.