Git Configuration
Before making commits, you should tell Git who you are. Git attaches your name and email to every commit you make, so this information should be set once on each machine you use.
Git configuration works at three levels: system (all users), global (your user account), and local (a single repository). The `git config` command lets you view and change these settings.
git config --global user.name "Name"
git config --global user.email "email"Setting your identity
Use `git config --global user.name "Your Name"` and `git config --global user.email "you@example.com"` to set your identity for all repositories on your machine.
Viewing configuration
Run `git config --list` to see all current settings, or `git config user.name` to check a single value. Local settings inside a repository override global ones.
git config --global user.name "Alex Smith"
git config --global user.email "alex@example.com"Sets your name and email globally so every commit is attributed to you.
git config --listuser.name=Alex Smith
user.email=alex@example.comLists all current Git configuration values.
Key points
- git config sets your name and email for commits.
- --global applies settings to all repositories on your machine.
- Local repo config overrides global config.
- git config --list shows all current settings.
