Git Setup and Configuration

Install Git, then configure your identity and a few sensible defaults. Your name and email are stamped onto every commit you make.

Install & verify

git --version      # confirm Git is installed

Download from git-scm.com (or use your OS package manager). macOS and Linux often have it already.

Set your identity

bash
git config --global user.name "Bhanu Chandar Bala"
git config --global user.email "you@example.com"
bash
git config --global init.defaultBranch main   # name new branches "main"
git config --global core.editor "code --wait"  # use VS Code for messages
git config --global pull.rebase false           # merge on pull (or true to rebase)
git config --global credential.helper store     # remember credentials

Config levels

LevelFlagApplies to
System--systemevery user on the machine
Global--globalyour user (all your repos)
Local--localthe current repo only (overrides global)

A local setting beats a global one β€” handy for using a work email in one repo and a personal email in another.

Check your config

git config --list              # everything
git config user.email          # one value
Tip: Set up aliases for commands you type often: git config --global alias.st status lets you run git st.
Free preview. Sign in and subscribe to unlock all 809 lessons across 25 courses.
Git Setup and Configuration β€” Git & GitHub | Full Stack Learning Simplified