[git] How can I remove an entry in global configuration with git config?

I ran a global configuration command in git to exclude certain files using a .gitignore_global file:

git config --global core.excludesfile ~/.gitignore_global

Is there a way to undo the creation of this setting globally?

This question is related to git

The answer is


You can edit the ~/.gitconfig file in your home folder. This is where all --global settings are saved.


You can check all the config settings using

git config --global --list

You can remove the setting for example username

git config --global --unset user.name

You can edit the configuration or remove the config setting manually by hand using:

git config --global --edit 

Try this from the command line to change the git config details.

git config --global --replace-all user.name "Your New Name"

git config --global --replace-all user.email "Your new email"

Open config file to edit :

git config --global --edit

Press Insert and remove the setting

and finally type :wq and Enter to save.


git config information will stored in ~/.gitconfig in unix platform.

In Windows it will be stored in C:/users/<NAME>/.gitconfig.

You can edit it manually by opening this files and deleting the fields which you are interested.


Try these commands to remove all users' usernames and emails.

git config --global --unset-all user.name
git config --global --unset-all user.email

You can use the --unset flag of git config to do this like so:

git config --global --unset user.name
git config --global --unset user.email

If you have more variables for one config you can use:

git config --global --unset-all user.name