Before you start making commits, Git needs to know who you are. Every commit you make will be associated with your name and email address. This is crucial for tracking contributions and identifying authors of changes. Think of it like putting your signature on your work, but for code!
You can configure your user name and email globally (for all your Git projects on your machine) or locally (for a specific project). For beginners, setting it globally is usually the easiest and most practical approach.
To set your user name globally, open your terminal or command prompt and run the following command, replacing "Your Name" with your actual name:
git config --global user.name "Your Name"Similarly, to set your email address globally, use this command, replacing "your.email@example.com" with your actual email address:
git config --global user.email "your.email@example.com"It's a good practice to use the same email address you use for your GitHub account, as this will help link your local contributions to your online profile.
You can verify your settings at any time by running these commands:
git config --global user.name
git config --global user.emailThese commands will output your currently configured user name and email address. If you ever need to change them, simply re-run the git config commands with your updated information.
Here's a visual representation of the configuration process:
graph TD
A[Open Terminal/Command Prompt] --> B{Run git config command}
B -- Set User Name --> C[git config --global user.name "Your Name"]
B -- Set User Email --> D[git config --global user.email "your.email@example.com"]
C --> E[Configuration Complete]
D --> E