Getting Started - Git Configurations
Git is a distributed version control system. It is an open source project that is actively maintained. It is free for everyone to use.
To install Git, please refer to this article.
After installing Git, you would need to set or update some configurations in order to customize the Git environment. git config
is a tool that lets us get and set configuration variables.
Configuration Levels in Git
There are 3 different configuration levels present in Git:
- Local
- This is the default configuration level.
- Configurations stored at the local level apply only to that repository.
- Global
- They are user specific configurations. Configurations stored at this level apply to the operating system user.
- System
- Configurations stored at the system configuration level apply across the machine.
- To store configurations at the system level, you would need admin privileges.
The order of priority of configurations levels is local, global and system. So, if we set same configuration at local and global levels, then the value of the configuration at the local level will be used.
Basic Configurations to Get Started
The primary configurations you would need to set are user name and email. These can be set at the global level since these are user specific configurations. In order to do so, you can run the command:
git config --global user.name <user name>
git config --global user.email <email>
Checking Configurations
To check the lists of configurations that are set, you can run the following command:
git config --list
In order to see at which levels the configurations are set, you can add the show-origin
option:
git config --list --show-origin
This command displays the location of the configuration files that has the mentioned configuration.
It is also possible to check value of a specific configuration. For example, if we want to see the value that is set for user name configuration, we can run the following command:
git config user.name