What is git config global?

Git (an acronym of Global Information Tracker) is a distributed version control system that is used to store files/code and then the content can be accessed either locally or remotely. It facilitates the programmers to work in parallel manner and as it tracks the recent changes made in the code and the developers can fall back to the previous versions also. The Git repositories are managed by GitHub; GitHub is cloud based service dedicated to providing extended functionalities of Git and to control its repositories. Although it is noticed that Git is widely used for handling source code, it is also being used for several other purposes like human resource departments, marketing organizations, customer support providence. Once the Git repository is set, one can edit the configuration settings by using Git Config command; For instance, if you have set a local repository Git, you may require adding username, email by issuing the Git Config. This command supports three levels; “local”, “global” and “system”; these flags used with the Git config command helps to manipulate configuration files. In this guide, we will provide a deep insight into the Git config command at global level in Ubuntu.

How to use Git Config Global in Ubuntu

Firstly, you have to access the “.gitconfig” file by using Ubuntu terminal; there are multiple ways to edit this file, the easiest way is by using the following command in terminal:

$ git config --global --edit

Adding variable and properties inside Git config global : The “.gitconfig” primarily deals with the variables and the properties associated to these variables: In case you want to add the properties directly using terminal then you can use the command written below:

The below mentioned commands will add name of user and email of that user to the “.gitconfig” file:

$ git config --global user.Name linuxhint

$ git config --global user.Email

A picture containing logo Description automatically generated

You can add new variables in Git config global file by using “–add” flag; For instance, the command written below will add the variable “editor” and set the name property of this variable:

$ git config --global --add Atom

Getting the content of Git config global : Once you have made changes, you can verify the changes by issuing the command stated below; it is observed that the changes made in the above section are displayed in the output. Additionally, the path of the config file is also shown alongside each property:

$ git config --global --list --show-origin

Text Description automatically generated with medium confidence

Or you can get the changes by using the command mentioned below:

The difference between both commands is the display of path: the “–showorigin” displays the path of the file where changes are made:

$ git config --global --list

Text Description automatically generated

Checking the editor of Git Config Globals : You can check the editor by opening the “.gitconfig” file using the command mentioned below; this command will automatically open the file in the default editor, in our case it is nano as shown in the image below:

$ git config --global --edit

Text Description automatically generated

Changing Git Global editor : By default, the “.gitconfig” is opened in nano text editor; if you want to change the default editor, the following commands will assist you to set the editor of your own choice:

For instance, if you want to set atom editor for Git config global then copy and paste the command written below in your Ubuntu terminal:

$ git config --global core.editor “atom --wait”

Or you can execute the command mentioned below to set “vim” as default editor for “.gitconfig” file:

$ git config --global core.editor “vim

How to unset editor of Git config global : One can add multiple properties inside “.gitconfig” file and also can change the default editor of this file: in case, you want to reset the changes to default; you can do so by using the “–unset” flag of “Git config global” command:

To unset the changes related to editor; use the command mentioned below; this command will remove all the changes that were made on “core.editor”:

$ git config --global --unset-all core.editor


Git has eased the working structure of multiple organizations and especially the programmers around the globe; these repositories produce fruitful results in a collaborative working environment. Moreover, Git repositories are backed up by GitHub to provide cloud-based access to Git repositories that means files can be accessed locally as well as globally too. In this descriptive guide, we have provided the detailed usage of the Git config command at its global level; this global level of Git config is associated with the “.gitconfig” file. We have discussed the editing operations and the fundamental usage of this command. Moreover, the major editing functions discussed in this guide include: the properties and changing the editor of this file.

About the author

Adnan Shabbir