Git & GitHub · Getting Started

Installing Git

Installing Git takes five minutes. Two installer choices and two config commands save you trouble later.

Beginner 5 min Lesson 2 of 19Shows Git 2.47 and GitHub.com as of 2026. GitHub changes its layout from time to time; button names stay the same.
0/19 in Git & GitHub
On this page · 5 min · Beginner

Learning objectives#

  • Install Git on your operating system
  • Choose sensible installer options on Windows
  • Set your name and email for commits
  • Check the installation from a terminal

Explanation#

Windows: download Git for Windows from git-scm.com and run it. Most defaults are right. Change two: set the default branch name to main (GitHub’s default) and choose Visual Studio Code as Git’s editor. The installer also gives you Git Bash, a terminal with Linux-style commands.

macOS: run git --version in Terminal; if Git is missing, macOS offers to install the Command Line Tools. Or use Homebrew: brew install git. Linux: sudo apt install git (Ubuntu/Debian) or sudo dnf install git (Fedora).

Every commit records an author. Set yours once with git config --global user.name and user.email. Use the same email as your GitHub account (or GitHub’s private noreply address) so commits link to your profile.

Step-by-step screens#

Drawings of github.com, the Git installer, VS Code and a terminal. GitHub changes its layout from time to time; the button names stay the same. The red numbers match the numbered actions under each picture; names on your computer will differ.

Loading pictures…

Code example: Check and configure Git once per computer#

ShellCheck and configure Git once per computer Illustrative
git --version
git config --global user.name "Asha Verma"
git config --global user.email "asha@example.com"
git config --global init.defaultBranch main
git config --global --list
Expected output
git version 2.47.1.windows.1
user.name=Asha Verma
user.email=asha@example.com
init.defaultbranch=main

This example is illustrative. Copy or download it and run it in your own environment; the expected output is shown above.

Step-by-step explanation#

  1. git --version proves Git is installed and on your PATH.
  2. user.name and user.email are written into every commit you make.
  3. init.defaultBranch main makes new repositories start on main, like GitHub.
  4. --list shows the settings saved in your global .gitconfig file.

Real-world use case#

On a new office laptop, a developer installs Git, sets name and email, and can clone the team’s repositories straight away.

Common mistakes#

Skipping user.name and user.email

Git refuses to commit (“Please tell me who you are”) or uses a wrong name that won’t link to your GitHub profile.

Using an old terminal window

Terminals opened before the install don’t see the new PATH. Open a new one.

Best practices#

  • Use the same email as on GitHub
  • Set main as the default branch
  • Pick an editor you know (VS Code)
  • Update Git now and then

Remember this#

git --version checks the install.

Set user.name and user.email once with --global.

Default branch: main.

Practice exercise#

Your task: Show only the email address Git will use for your commits.

Show solution
Shell Illustrative
git config user.email

Mini quiz#

Installing Git quizMultiple choice Question 1 of 1

Why should user.email match your GitHub account?

Score so far: 0/0

Want more? Practise all Git & GitHub MCQs · Git & GitHub interview questions

My notes#

Saved in this browser.

Progress is saved in this browser. Sign in to sync.