How to Display Git Global Configuration

Posted on

Introduction

This article will discuss about how to display global configuration of git local repository. It is useful to get the correct information about the configured user and also email of the git local repository. The value of each setting or configuration will be used for maintaining source code versioning in Git Repository. In this context, ‘git’ is actually an utility for managing the versioning of either application files or source codes. It is a command available after the installation of ‘git’ package itself. So, in order to be able to execute the ‘git’ command, make sure that it is exist and it is available in the machine. Execute the following command to check the existence of the ‘git’ package or ‘git’ command :

user@hostname:~$ apt-cache search ^git$
git - fast, scalable, distributed revision control system
user@hostname:~$ 

The above command is for checking the availability of the ‘git’ package in Linux Ubuntu family. The following command is the command for checking whether the ‘git’ package’ is available and it is already installed in the machine :

user@hostname:~$ apt list --installed | grep "^git"

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

git/bionic-updates,bionic-security,now 1:2.17.1-1ubuntu0.4 amd64 [installed]
git-man/bionic-updates,bionic-security,now 1:2.17.1-1ubuntu0.4 all [installed,automatic]
gitlab-ce/now 8.14.3-ce.0 amd64 [installed,local]
user@hostname:~$ 

Displaying Git Local Configuration

After checking whether the ‘git’ command or utility is available or not, just execute it if it exist. If it is not exist just continue on the installation of the package first. The package name is exist as in the previous output. The name is ‘git’. Moving forward, the following is the command for displaying the git local configuration which is used globally in the machine :

git config --list

The command pattern above for listing the global configuration of git exist in the following command execution for an example :

user@hostname:~$ git config --list

user.email=myuser@mymail.com
user.name=myuser user@hostname:~$

In the output of the above command, there is a global information presented about the user information. It is the user information configured in order to interact with the remote git server repository. It will use the name and also the email parameter in order to communicate with the git server repository.

Leave a Reply