← Back to Git Course | Chapter 1: Introduction & Setup | Lesson 4 of 7

Git Configuration

Setting Your Username

Git refuses to let you commit until it knows who you are, so before your first commit you set your name globally with git config --global user.name, and that name gets permanently baked into every snapshot you save.

Example: Setting Your Username

bash
git config --global user.name "Your Name"

Setting Your Email

Alongside your name, Git also records your email address on every commit -- this is the value platforms like cookiescursor.com use to match your commits to your account, so it's worth double-checking it matches what you registered there.

Example: Setting Your Email

bash
git config --global user.email "[email protected]"

Setting the Default Editor

When a command needs you to type a message (like an interactive commit), Git launches whatever text editor you've configured -- Nano is beginner-friendly, Vim is fast once learned, and VS Code can be set as the default if you prefer a GUI.

Example: Setting the Default Editor

bash
git config --global core.editor "code --wait"

Listing Your Configurations

Running git config --list prints every active setting Git is currently using, along with which config file each one came from, which is the fastest way to debug 'why is Git doing that' when behavior doesn't match what you expect.

Example: Listing Your Configurations

bash
git config --list

Scope of Configurations

Git configuration is layered in three scopes: --system applies to every user on the machine, --global applies only to your user account, and --local applies only inside the current repository -- with local settings overriding global ones when they conflict.

Example: Scope of Configurations

bash
git config --system --list
git config --global --list
git config --local --list
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.