Git

How Can I Remove an Entry in Global Configuration With “git config”

Like other tracking versions of software, Git users are also allowed to set the permissions and entry values that are applied on all available repositories, such as “Global” configurations. Globally added value can be the username, password, email address, and many more. Additionally, these values can be removed through the terminal and default editor by executing the “git config” command.

This study will provide:

How to Delete an Entry in Global Configuration With Git Terminal?

To remove the desired entry in a global configuration using the “git config” command with the Git terminal, try out the following instructions.

Step 1: Redirect to Git Root Directory

First, use the “cd” command and switch to the Git root directory:

$ cd "C:\Users\nazma\Git"

Step 2: View Global Config List

To display the list of global configuration list, run the “git config” command along with the “–global” and “–list” options:

$ git config --global --list

As you can see, the whole list of global configuration entries are displayed, and we want to remove the “core.excludesfile” entry from the global list:

Step 3: Remove ‘core.excludesfile’ Global Entry

Now, remove the global entry from the configuration list by executing the provided command:

$ git config --global --unset core.excludesfile

In the above-stated command, the “–unset” option is used to remove the existing value of the “core.excludesfile” entry:

Step 4: Verify Global Configuration List

Lastly, use the provided command to ensure that the previously unset value of the particular entry is removed from the global configuration list:

$ git config --global --list

It can be observed that the desired global configuration entry is removed successfully:

How to Delete an Entry in Global Configuration With Default Editor?

Another way to remove the global configuration entry using the “git config” command is manually by executing the provided command:

$ git config --global --edit

Here, the “–edit” option is used to open the Git config file with a default text editor. Search for the desired entry, and remove them. Then, save changes and close the opened editor:

To verify the above performed removing operation, execute the provided command:

$ git config --global --list

As you can see, the required entry is removed from the Git config file:

That’s all! We have provided the method for removing the desired entry in Git global configuration file.

Conclusion

To delete any desired entry in global configuration with Git terminal by executing the “git config –global –unset core.excludesfile” command can be used. Another way to delete the global entry is manually through the default editor with the help of the “git config –global –edit” command. This study described the ways of removing an entry in the Git global configuration file.

About the author

Maria Naz

I hold a master's degree in computer science. I am passionate about my work, exploring new technologies, learning programming languages, and I love to share my knowledge with the world.