Git is a small command-line program. Once installed, it's available everywhere on your machine as the git command. This lesson covers installation on Windows, macOS, and Linux, the four config commands every new install needs, and the basic terminal navigation you'll lean on for the rest of the course. If you've never used a terminal, this is the lesson where that fear ends.
Check first — Git may already be installed
Many systems ship with Git or installed it as part of another tool (Xcode, Homebrew, VS Code). Open a terminal — PowerShell or Git Bash on Windows, Terminal on macOS or Linux — and run:
git --versionIf Git is installed, you'll see something like:
git version 2.45.2
If you see command not found or 'git' is not recognized, install it.
Installing on Windows
- Visit https://git-scm.com and download the installer.
- Run it. Most defaults are fine — three options worth confirming:
- Default editor — pick Visual Studio Code. Git opens this when it needs you to type a longer message (e.g., resolving a merge).
- Adjust PATH — pick "Git from the command line and also from third-party software." This lets
gitwork in PowerShell and Command Prompt, not just Git Bash. - Default branch name — choose main. (The old default was
master; the industry has moved on.)
- Finish. Open Git Bash (installed alongside) or restart PowerShell, then re-run
git --versionto confirm.
Installing on macOS
The simplest path: trigger Apple's developer-tools installer, which includes Git.
xcode-select --installA dialog appears; accept it. Five minutes later, git --version works. Or, if you use Homebrew:
brew install gitInstalling on Linux
Ubuntu, Debian, and most derivatives:
sudo apt update
sudo apt install gitCentOS, RHEL, Fedora:
sudo yum install gitConfirm with git --version.
First-time configuration — your identity
Git stamps every commit with the author's name and email. Without these, commits are anonymous and many remotes (GitHub included) will reject your push. Set them once, globally, and every repo on the machine inherits them:
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"Use the same email as your GitHub account — that's how GitHub links commits to your profile and avatar.
Two more configs worth setting
Default editor. Git will open this for commit messages, merge conflicts, and rebase scripts. VS Code is the friendliest:
git config --global core.editor "code --wait"The --wait flag tells VS Code "don't return until I close the file" — Git waits for the message before continuing.
Default branch name. When you create a new repo, this is the branch Git starts on:
git config --global init.defaultBranch mainVerify everything
Run:
git config --listExpected output (your values will differ):
user.name=Your Name
user.email=your.email@example.com
core.editor=code --wait
init.defaultBranch=main
Anything missing? Re-run the matching git config command above.
A two-minute terminal primer
If cd, ls, and pwd are new to you, take two minutes to make peace with them. The terminal is just a typed way of doing what File Explorer or Finder do with clicks. The five commands below cover 90% of what you'll do in this course.
| Command | What it does | Example |
|---|---|---|
pwd | Print Working Directory — shows where you are | pwd → /Users/you/projects |
ls (dir on Windows CMD) | List files in the current folder | ls |
cd folder-name | Change Directory — move into a subfolder | cd webapp-tests |
cd .. | Move up one folder | cd .. |
mkdir name | Make a new directory | mkdir my-test-project |
On Git Bash (Windows) and macOS/Linux Terminals, ls and pwd work the same — Git Bash gives Windows users a Unix-style shell. The Linux CLI cheat sheet for testers is a fuller reference once you want more.
The setup flow at a glance
Step 1 of 5
Check for Git
Open a terminal and run git --version. If it prints a version, skip to step 3.
Why your name and email matter — a real example
When you commit, Git embeds your name and email into the commit object permanently. Later, git log shows them:
git log --oneline --pretty=format:"%h %an <%ae> %s"4c48901 Vimal Vithalpura <itsvimal@yahoo.com> Add login regression tests
That's how teammates see who wrote what. GitHub uses the email to attach the commit to a user profile — wrong email, wrong avatar, no contribution credit on the green graph.
⚠️ Common mistakes
- Skipping
git config user.emailand using a different one per machine. Different emails fragment your contribution history on GitHub — some commits attribute, some don't. Pick one email (your GitHub email) and set it the same way on every machine. - Forgetting the
--globalflag. Without--global, the config applies only to the current repo (which doesn't exist yet on a fresh install, so the command silently fails or only affects that single repo). Use--globalfor personal defaults; drop it later if a specific repo needs different settings. - Installing Git but never opening a terminal. GUI clients (GitHub Desktop, Sourcetree) are fine, but every Git tutorial, error message, and Stack Overflow answer assumes the command line. Spend a week typing the commands; switch to a GUI later if you want, with the underlying model in your head.
🎯 Practice task
A clean install + config from start to finish. 20-25 minutes including any download time.
- Run
git --version. Either confirm it prints a version, or follow your OS's install steps above. - Set your name:
git config --global user.name "Your Name". Use your real name; this appears on every commit publicly. - Set your email:
git config --global user.email "your.email@example.com". Use the email tied to your GitHub account if you have one. - Set your editor:
git config --global core.editor "code --wait"(skip if you don't have VS Code). - Set the default branch:
git config --global init.defaultBranch main. - Run
git config --listand confirm all four values appear. - Stretch: open the file
~/.gitconfig(Windows:C:\Users\YourName\.gitconfig) in a text editor. You'll see the same values in plain text — that's the file Git reads for global config. Knowing where it lives saves you when something looks wrong.
You now have a working Git installation. The next lesson uses it to create your first repository.