Before you can wield Git as your history-forging hammer, you need to install it and teach it who you are. Installation is the doorway, configuration the handshake. Git without config is like a blank passport—you can travel, but nobody knows it’s you.
Installing Git on Different Platforms
Linux
Most Linux distributions include Git in their package repositories. Installation is as simple as:
sudo apt update && sudo apt install git -y # Debian/Ubuntu
sudo dnf install git # Fedora
sudo pacman -S git # Arch
After installation, check version:
git --version
macOS
On macOS, you can install Git via Homebrew or Xcode Command Line Tools.
brew install git
xcode-select --install # alternative
Windows
On Windows, download Git for Windows from git-scm.com. The installer includes Git Bash, a Unix-like shell that makes life easier. Chocolatey users can install with:
choco install git
Verification is universal:
git --version
Global Configuration
Once installed, configure your identity. Commits need an author name and email. Without them, history has no provenance.
git config --global user.name "Jakub Jirák"
git config --global user.email "jakub@example.com"
Check your settings:
git config --list
Git stores this config in ~/.gitconfig. Repository-specific overrides live in .git/config.
The Three Levels of Configuration
Git’s settings can exist in three scopes:
- System: applies to all users on a machine (
/etc/gitconfig). - Global: applies to a single user (
~/.gitconfig). - Local: applies only to a repo (
.git/config).
Visualization:
flowchart TD
Sys[System Config] --> Global[Global Config] --> Local[Local Config]
Local always overrides global, global overrides system.
Useful Configuration Options
Default Branch Name
New Git versions default to main, but you can set explicitly:
git config --global init.defaultBranch main
Editor
Specify your preferred editor for commit messages:
git config --global core.editor "code --wait" # VS Code
git config --global core.editor "nano" # Nano
Aliases
Shorten commands:
git config --global alias.st status
git config --global alias.co checkout
git config --global alias.br branch
Now git st shows status, git co checks out branches.
Credential Management
On macOS and Windows, Git integrates with keychains. On Linux, you can use credential helpers:
git config --global credential.helper store
git config --global credential.helper cache
For GitHub, SSH keys are preferred. Generate:
ssh-keygen -t ed25519 -C "jakub@example.com"
Add to GitHub, then test:
ssh -T git@github.com
Visualization of Config Layers
flowchart TD
A[System Config] -->|base defaults| B[Global Config]
B -->|user overrides| C[Local Repo Config]
C -->|applies to| Repo[Repository]
This illustrates how values cascade.
Solo Workflow Example
As a solo developer, you configure once globally and mostly forget. Your name and email become your signature on every project.
git config --global user.name "Alice Example"
git config --global user.email "alice@example.com"
Commits across all repos now bear your mark.
Team Workflow Example
On a team, you might use different identities for work and personal repos. Local config lets you override global:
cd ~/work/project
git config user.name "Jakub (Work)"
git config user.email "jakub@company.com"
Now this repo’s history shows your corporate identity, while global remains personal.
Think Different Mindset
Installing Git isn’t just downloading a tool. Configuring Git is staking your authorship in history. Every commit is signed with your name and email, a public declaration: I was here; I made this. This teaches responsibility. Code is ephemeral, but history is forever. Config is your way of claiming your story.
Installation is trivial; configuration is cultural. By installing Git, you unlock the tool. By configuring Git, you claim ownership of history. With identity set and editor ready, you’re no longer just an observer. You’re a historian with a pen. In the next chapter, we’ll create our first repository and watch Git’s anatomy spring into action.