0
0
Gitdevops~5 mins

Global vs local configuration in Git - Quick Revision & Key Differences

Choose your learning style9 modes available
Recall & Review
beginner
What is the difference between global and local configuration in Git?
Global configuration applies settings to all repositories for a user on a machine, while local configuration applies settings only to a specific repository.
Click to reveal answer
beginner
How do you set your user name globally in Git?
Use the command: git config --global user.name "Your Name" to set your user name for all repositories.
Click to reveal answer
beginner
How do you check the local Git configuration for a repository?
Run git config --local --list inside the repository folder to see local settings.
Click to reveal answer
intermediate
If a setting exists in both global and local Git configurations, which one takes effect?
The local configuration overrides the global configuration for that repository.
Click to reveal answer
intermediate
Where are Git global and local configuration files stored?
Global config is stored in ~/.gitconfig (user home directory). Local config is stored in .git/config inside the repository folder.
Click to reveal answer
Which command sets a Git configuration only for the current repository?
Agit config --local user.email "email@example.com"
Bgit config --global user.email "email@example.com"
Cgit config --system user.email "email@example.com"
Dgit config --all user.email "email@example.com"
Where is the global Git configuration file located?
A.git/config
B/etc/gitconfig
C~/.gitconfig
D/usr/local/gitconfig
If a Git setting is defined both globally and locally, which setting is used when working in that repository?
AGlobal setting
BLocal setting
CSystem setting
DThe first one set
What does the command git config --list show by default?
AAll configuration including system, global, and local
BOnly global configuration
COnly local configuration
DOnly system configuration
Which Git configuration level applies settings for all users on a system?
ALocal
BGlobal
CUser
DSystem
Explain the difference between Git global and local configuration and when you would use each.
Think about settings that apply everywhere vs. settings for one project.
You got /4 concepts.
    Describe how Git decides which configuration to use if the same setting exists in multiple places.
    Consider the scope of each config level.
    You got /3 concepts.