Git Config: Set Your Commit Name and Email
Identity is metadata, not a login
Git stores author and committer information with commits. user.name and user.email normally supply these values unless overridden by more specific settings or environment variables. They are not a GitHub username/password pair and do not authenticate you to a remote server. For this private practice repository use a fictional identity.
Set values for this repository only
From the practice repository root, set a local name and email. --local means the settings are stored for the current repository, normally in .git/config. The quotation marks group the two-word name as one argument. The example.invalid domain is reserved for examples; do not use it as your actual professional identity.
git config --local user.name "ByteMind Learner"git config --local user.email learner@example.invalidRead back what you wrote
The following queries read only the named keys from the local configuration. In this lab the two lines are ByteMind Learner and learner@example.invalid. Without a value argument, the command reads instead of setting a value. Avoid printing a full configuration dump because it can contain personal details or sensitive URLs.
Local versus global configuration
Global settings normally apply to repositories used by your account; local settings normally take precedence for the same key. Command-specific or environment overrides can alter effective values. To inspect the effective name without restricting the scope, use git config user.name. The following command also reports its source file. Do not change global settings for this lab.
Privacy, practice and the next step
Names and emails can become visible in commit history when you share it. For actual public work choose the identity appropriate to your project, including a GitHub-provided no-reply address if desired. Changing configuration does not rewrite old commits. Never put passwords or access tokens in these fields. Practice by setting a different fictional name in the lab, reading it back, and restoring the original fictional value. Your repository is now ready for the next chapter on staging and committing files.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Git Config: Set Your Commit Name and Email — knowledge check
Apply the lesson to common beginner scenarios.
What does git config --local user.name "ByteMind Learner" set?
Which command reads the local email setting?
A local name differs from the global name. In the absence of other overrides, which wins?
What happens to old commits if you change user.email?
Why should you not put an access token into user.email?