How to show Local Git Repository Configuration

Posted on

This is an article where the purpose of the writing is defined in the title of this article which is informing on how to show local git repository configuration. Showing the configuration of the existing local git repository configuration is very useful. The usage among of the other is retrieving the information of the user which is used to communicate with another say for an example a remote git repository.

Below is the command which can be performed in order to list or to display the git local repository configuration :

git config --list

Make sure that the git utility is already installed. To make sure whether the git utility has already been installed just type the command ‘git’ in the command line or terminal.

Below is the example of the output of the above command executed in the command line or terminal :

user@hostnane:~/myproject$ git config --list Rowling

The above configuration output which is presented as the output generated by executing the above command can actually be retrieved from a file. The file which is storing all the configuration output of the local git repository located in the file named .git/config. But not only in the .git/config file where the command executed in the folder the output will be produced but also in the file named .gitconfig inside the home folder of a user where the user is already logged in.  So, among the other, the output of the git config –list is the combination of several git config file. Below are the configuration files which can be described :

The file config located inside the git repository folder precisely named as config where it is located in the hidden folder .git as shown below :

root@hostname:/root/myproject# tree -a -L 2
├── .git
│   ├── branches
│   ├── config
│   ├── description
│   ├── FETCH_HEAD
│   ├── HEAD
│   ├── hooks
│   ├── index
│   ├── info
│   ├── logs
│   ├── objects
│   ├── ORIG_HEAD
│   └── refs
├── notes-for-everyone
├── index.html

7 directories, 10 files

The content of the file is shown below :

repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = /root/remoteproject
fetch = +refs/heads/*:refs/remotes/origin/*

Another one located in /root/.gitconfig or usually in the user home folder and it is shown as follows :

name = Mike Rowling
email =
default = simple

Leave a Reply