0
0
Gitdevops~20 mins

.gitconfig file structure - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
.gitconfig Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding Sections in .gitconfig
Which section in a .gitconfig file is used to set the user's email address?
A[user]
B[core]
C[remote]
D[branch]
Attempts:
2 left
💡 Hint
Look for the section that stores user identity information.
💻 Command Output
intermediate
2:00remaining
Output of git config --list
Given this .gitconfig snippet, what will be the output of 'git config --list'?
Git
[core]
	editor = vim
[user]
	name = Alice
	email = alice@example.com
A
core.editor=vim
user.name=Alice
B
editor=vim
name=Alice
email=alice@example.com
C
core.editor=vim
user.name=Alice
user.email=alice@example.com
D
core.editor=vim
user.email=alice@example.com
Attempts:
2 left
💡 Hint
git config --list shows all key=value pairs with section prefixes.
Configuration
advanced
2:00remaining
Configuring Aliases in .gitconfig
Which .gitconfig snippet correctly defines an alias 'co' for 'checkout'?
A
[aliases]
	co = checkout
B
[alias]
	co = checkout
C
[alias]
	co: checkout
D
[alias]
	co-checkout = checkout
Attempts:
2 left
💡 Hint
Aliases are defined under the [alias] section with key = value syntax.
Troubleshoot
advanced
2:00remaining
Identifying Syntax Error in .gitconfig
Which option contains a syntax error that will cause git to fail reading the .gitconfig file?
A
[remote "origin"]
	url = https://github.com/user/repo.git
B
[core]
	editor = nano
C
[branch "main"]
	merge = refs/heads/main
D
[user]
name = Bob
Attempts:
2 left
💡 Hint
Check for missing indentation after section headers.
Best Practice
expert
2:00remaining
Best Practice for Global vs Local .gitconfig
Where should you place user-specific settings like name and email to apply them to all repositories on your machine?
AIn the global .gitconfig file located in the user's home directory
BIn the system-wide .gitconfig file in /etc/gitconfig
CIn the local .git/config file inside each repository
DIn the .gitignore file
Attempts:
2 left
💡 Hint
Think about settings that apply to all projects for one user.