Have you failed a job interview?
Send us your job interview questions and get correct answers.
When and why would you use git config command?
Experience Level: Medior
git config command is used for managing git configuration settings.
- All configuration settings are stored in a text file .gitconfig.
- The file consist of sections and key-value pairs where each key defines one property and value defines its value.
- There are multiple levels of configuration - System/Global/Local
Important configuration settings
- user.name - defines user name that will be used as an identifier of the person who committed the changes (Author)
- user.email - defines e-mail of a person who committed the changes (Author) - this e-mail will be visible in list of commits.
- core.editor - defines path to custom file editor
- System - configuration settings from this level are used across all user acounts on the computer.
- Global - configuration settings from this level are used for all repositories within a useraccount
- Local - configuration settings from this level are used for one repository only.
The configuration settings are inherited fromt he highest level (System) to the lowest level (Local). Each configuration setting can be overridden on the lower level.
There is one .gitconfig file for each configuration level, each file is stored in different location depending on the operating system and level
Related Git job interview questions
What is a difference between Git and TFS?GitSource control Medior
What is bare repository in Git?GitSource control Medior
When and why would you use git stash?Git Medior
What is git push good for?Git Medior
What is git pull good for?Git Medior