Git Configuration
In this page:
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
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
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
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
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
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: