0
0
Gitdevops~20 mins

Git configuration (user.name, user.email) - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Git Config Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
Check current Git user name configuration
What is the output of the command git config --global user.name if the global user name is set to "Alice Dev"?
Git
git config --global user.name
Anull
Buser.name
Cerror: key does not exist
DAlice Dev
Attempts:
2 left
💡 Hint
This command shows the global user name set in Git configuration.
💻 Command Output
intermediate
1:30remaining
Effect of missing user.email in Git commit
What error message appears if you try to commit in Git but the user.email is not set anywhere in the configuration?
Git
git commit -m "Test commit"
Aerror: user.email is not set
Bfatal: unable to auto-detect email address (got 'username@hostname')
Ccommit created successfully
Dwarning: user.email is empty, using default
Attempts:
2 left
💡 Hint
Git needs an email to identify the author of commits.
Configuration
advanced
2:00remaining
Set local Git user name and email for a repository
Which commands correctly set the local Git user name to "Bob Builder" and email to "bob@build.com" only for the current repository?
A
git config user.name "Bob Builder"
git config user.email "bob@build.com"
B
git config --global user.name "Bob Builder"
git config --global user.email "bob@build.com"
C
git config --local user.name "Bob Builder"
git config --local user.email "bob@build.com"
D
git config --system user.name "Bob Builder"
git config --system user.email "bob@build.com"
Attempts:
2 left
💡 Hint
Local config is the default when no flag is given.
Troubleshoot
advanced
2:00remaining
Diagnose why Git commit uses wrong email
You set your global Git email to "alice@example.com" but commits in a specific repository show author email as "old@example.com". What is the most likely cause?
AGit caches old email and needs restart
BGlobal config is ignored if user.name is missing
CThe repository has a local user.email set to "old@example.com" overriding global config
DThe commit message contains the old email explicitly
Attempts:
2 left
💡 Hint
Local config overrides global config in Git.
Best Practice
expert
2:30remaining
Best practice for managing Git user identity across multiple projects
You work on personal and work projects on the same machine. What is the best way to manage your Git user.name and user.email to keep identities separate?
ASet global user.name and user.email to your personal info, then set local user.name and user.email in work repos to work info
BSet global user.name and user.email to work info, then override locally for personal projects
CUse only global config for all projects and manually change before commits
DSet user.name and user.email only in system config for all projects
Attempts:
2 left
💡 Hint
Global config is default; local config overrides it per repo.