Before writing any code or tracking repositories, you must install the official Git binaries on your development machine and configure your author identity. Every Git commit you create embeds this identity permanently into the commit history.
For Windows developers, the official installer provides Git Bash (a lightweight Unix-like shell environment that includes standard Unix command-line utilities like ls, grep, cat, and ssh):
core.autocrlf = true).The cleanest way to install and maintain Git on macOS is using the Homebrew package manager:
# Install Homebrew if not already present
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install latest Git version
brew install git
Alternatively, opening Terminal and typing git --version will prompt Apple's Xcode Command Line Tools installer if Git is not yet installed.
On Linux distributions, use the native system package manager:
# For Ubuntu / Debian / Linux Mint:
sudo apt update
sudo apt install git -y
# For Fedora / Red Hat Enterprise Linux / Rocky Linux:
sudo dnf install git -y
# For Arch Linux:
sudo pacman -S git
Open your terminal (PowerShell, Command Prompt, Git Bash, or Terminal on Mac/Linux) and verify the installed version:
$ git --version
git version 2.44.0
Git comes with a built-in configuration tool called git config that lets you set configuration variables. These variables are stored in three different levels:
--system: Applied to all users on the operating system (stored in /etc/gitconfig).--global: Applied to your specific user profile across all repositories (stored in ~/.gitconfig).--local: Applied only to the current repository (stored in .git/config).You must set your author name and email address. This is critical because every single Git commit binds this metadata into its cryptographic hash:
# Set your global username
git config --global user.name "John Doe"
# Set your global email address (use your GitHub-associated email)
git config --global user.email "john.doe@example.com"
Historically, Git defaulted to naming the primary branch master. In 2020, GitHub and the open-source community adopted main as the modern, inclusive standard. Configure Git to automatically initialize new repositories with main:
git config --global init.defaultBranch main
Windows uses Carriage Return and Line Feed (CRLF) for line breaks, while macOS and Linux use Line Feed (LF). To prevent spurious diffs across cross-platform teams:
# On Windows:
git config --global core.autocrlf true
# On macOS and Linux:
git config --global core.autocrlf input
# To use Visual Studio Code:
git config --global core.editor "code --wait"
# To use Nano:
git config --global core.editor "nano"
# To use Vim:
git config --global core.editor "vim"
To inspect all configured values and see which file they originate from, run:
git config --list --show-origin
If an interviewer asks: "Where are Git global configurations stored on a user's machine?", answer: "In the user's home directory inside the hidden file named .gitconfig (e.g. C:\Users\username\.gitconfig on Windows or ~/.gitconfig on Linux/Mac)."
Strengthen your version control mastery by studying these connected classes:
Run git init to create new repos or git clone to download remote codebases.
Generate secure ed25519 SSH keys for passwordless authentication with GitHub.
Prevent node_modules, .env, and build artifacts from leaking into commits.
Quick-reference guide for all daily Git CLI options and configuration flags.
Advance your software engineering skills with the next topic in our synchronized curriculum.
Continue to Three-Tree Architecture → Previous: ← Intro & VCS History | Full Syllabus