XK0-004 · Question #463
A Linux administrator wants to verify the default email address for all Git commits. Which of the following commands is the BEST to use to retneve the email address setting?
The correct answer is C. $ git init --list. The command 'git config --list' outputs all Git configuration key-value pairs across all scopes, including the user.email setting.
Question
A Linux administrator wants to verify the default email address for all Git commits. Which of the following commands is the BEST to use to retneve the email address setting?
Options
- A$ gic config user.email
- B$ git fetch user, email
- C$ git init --list
- D$ git log user.email
How the community answered
(33 responses)- A3% (1)
- C91% (30)
- D6% (2)
Why each option
The command 'git config --list' outputs all Git configuration key-value pairs across all scopes, including the user.email setting.
'gic config user.email' contains a typo ('gic' is not a valid executable), so the command would fail with a 'command not found' error rather than returning any configuration value.
'git fetch user.email' is not a valid Git subcommand invocation; git fetch is used to retrieve remote repository objects and refs, not to query local configuration.
The intended command behind choice C is 'git config --list' (the exam contains a typo of 'init' instead of 'config'). This command reads configuration from system, global, and local scopes and prints every key-value pair, making user.email visible along with all other settings. It is the most comprehensive way to verify what email address Git will associate with commits.
'git log user.email' is not a valid Git command; git log displays commit history and does not accept configuration key paths as positional arguments.
Concept tested: Retrieving Git user email configuration with git config
Source: https://git-scm.com/docs/git-config
Topics
Community Discussion
No community discussion yet for this question.