git config --global user.name <username>
This command configures the default identity Git will attach to your commits across all repositories on your current machine, making sure your changes are properly attributed to you.
It runs the git config tool, which edits Git’s configuration settings; the --global flag tells Git to store the setting in your global config file (usually ~/.gitconfig) so it applies to every repo for your user account; user.name is the configuration key that controls the human-readable name shown in commit metadata; and <username> is the value you want to set, typically your real name like "Jane Doe". Without --global, this command would instead set the name only for the current repository, which is useful when you need a different identity per project, and you can also use the equivalent git config -global user.name <username> only if your shell aliases it that way (normally you should stick with --global). You can verify what is set with git config user.name (local repo) or git config --global user.name (global), and remove it by running git config --global --unset user.name.
Closely related variations include setting your email with git config --global user.email <email> so that hosting services like GitHub can link your commits to your account, or using git config user.name <username> inside a single repo to override the global value just for that project. You can list all current settings with git config --list or see where a value comes from using git config --show-origin --get user.name, and for temporary one-off use you can bypass config entirely by prefixing a command with GIT_AUTHOR_NAME="Temporary Name" GIT_AUTHOR_EMAIL="temp@example.com" git commit. These commands work together to give you flexible, per-machine and per-repository control over how Git identifies you in commit history.
Examples:
git config --global user.name "Jane Doe"git config user.name "Project-Specific Name"