Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Git configuration (user.name, user.email)
📖 Scenario: You have just installed Git on your computer. Before you start saving your work, you need to tell Git who you are. This helps Git keep track of who made changes in projects.
🎯 Goal: Set up your Git user name and email address so that your commits are properly identified.
📋 What You'll Learn
Use the git config command to set your user name
Use the git config command to set your user email
Verify the configuration settings
💡 Why This Matters
🌍 Real World
Every time you make changes in a project, Git records who made those changes using your configured user name and email.
💼 Career
Knowing how to configure Git user details is essential for collaborating on code in teams and contributing to open source projects.
Progress0 / 4 steps
1
Set your Git user name
Use the command git config --global user.name "Alice Johnson" to set your Git user name to exactly "Alice Johnson".
Git
Hint
Remember to include the exact name with quotes.
2
Set your Git user email
Use the command git config --global user.email "alice.johnson@example.com" to set your Git user email to exactly "alice.johnson@example.com".
Git
Hint
Use the exact email address with quotes.
3
Check your Git configuration
Use the command git config --global --list to display your current global Git configuration settings.
Git
Hint
This command shows all your global Git settings.
4
View the configured user name and email
Run the command git config --global user.name and then git config --global user.email to print your configured user name and email separately.
Git
Hint
These commands print your user name and email on separate lines.
Practice
(1/5)
1. What is the purpose of setting user.name and user.email in Git configuration?
easy
A. To set the default branch name
B. To enable Git debugging mode
C. To configure the remote repository URL
D. To label your commits with your identity
Solution
Step 1: Understand Git commit metadata
Git uses user.name and user.email to identify who made each commit.
Step 2: Recognize the role of these settings
These settings label your work so others know who made changes.
Final Answer:
To label your commits with your identity -> Option D
Quick Check:
user.name and user.email = commit identity [OK]
Hint: Remember: name and email tag your commits [OK]
Common Mistakes:
Confusing user.name with branch name
Thinking user.email sets remote URL
Assuming these enable debugging
2. Which command correctly sets your global Git user email to "user@example.com"?
easy
A. git config --email user@example.com --global
B. git config --global user.email user@example.com
C. git config user.email --global user@example.com
D. git set user.email global user@example.com
Solution
Step 1: Recall correct Git config syntax
The correct syntax is git config --global key value.
Step 2: Match the command to set user.email globally
git config --global user.email user@example.com matches this syntax exactly.
Final Answer:
git config --global user.email user@example.com -> Option B
Quick Check:
git config --global key value sets global config [OK]
Hint: Use 'git config --global key value' format [OK]