You need Git installed and configured before you can track any changes. Think of this as setting up your workspace before starting any project.
Installing Git
Windows: Download Git from git-scm.com. Run the installer and accept the default options. You don't need to understand what each setting does right now. The defaults work fine.
Mac: Open Terminal and type git --version. If Git isn't installed, macOS will prompt you to install developer tools. Click Install and wait.
Linux: Use your package manager. On Ubuntu or similar: sudo apt install git. On other distributions, substitute your package manager.
Verify the installation by opening your terminal or command prompt and typing:
git --version
You should see something like "git version 2.41.0" or similar. The exact number doesn't matter as long as you get a version back.
Configuring your identity
Git needs to know who you are before you make any commits. This information gets attached to every change you save, which becomes important when working with others or looking back at old work.
Set your name:
git config --global user.name "Your Actual Name"
Set your email:
git config --global user.email "your.email@example.com"
Use your real name and a real email address. If you plan to use GitHub, GitLab, or similar services later, use the same email you'll sign up with there.
The --global flag means this configuration applies to all Git repositories on your computer. You set this once and forget it.
Creating your first repository
Find or create a folder for a project you want to track. This could be anything: a website, writing project, or collection of files you don't want to lose.
Navigate to that folder in your terminal. If you're not comfortable with terminal navigation yet, here's the quick version:
cd foldernameto enter a foldercd ..to go up one levells(Mac/Linux) ordir(Windows) to see what's in the current folder
Once you're in your project folder, type:
git init
Git responds with "Initialized empty Git repository in .git/" or something similar. You've just created a repository. Git is now watching this folder, though it's not tracking anything yet.
You'll notice a new hidden folder called .git appeared in your directory. This folder contains all of Git's tracking information. Don't mess with it directly. Git manages everything in there.
Telling Git what to skip
Not everything in your project folder belongs in Git. Build files, dependency folders, and files with passwords or API keys should stay out of your history. Git lets you define what to ignore with a special file called .gitignore.
Create it in your project's root folder:
touch .gitignore
Open it in any text editor and add patterns for files you want Git to pretend don't exist:
node_modules/
.env
*.log
.DS_Store
Each line is a pattern. node_modules/ ignores an entire folder. *.log ignores every file ending in .log. Once a pattern is in .gitignore, those files won't show up in git status and won't get included when you run git add ..
Create this file before your first commit. If you accidentally track something first and add it to .gitignore later, Git keeps tracking it until you explicitly remove it — an annoying gotcha you can avoid by setting up .gitignore right away.
You don't have to memorize which files to ignore. GitHub maintains starter templates for different project types at github.com/github/gitignore. Grab the one closest to your project and adjust from there.
What you've accomplished
Your computer now has Git installed and knows who you are. You've created your first repository in a project folder. Git is ready to start tracking changes, but it's not tracking anything automatically.
The repository exists only on your computer right now. It's completely private and safe to experiment with. You can't break anything important by trying Git commands on this local repository.
Next, you'll learn how to tell Git which files to pay attention to and how to save your first snapshot of your work.