'How to delete a git configuration?

Basically, I entered:

git config --global use.name "My name"

Notice I wrote "use.name" instead of "user.name." But now that field is there, so I was wondering how to delete it.

git


Solution 1:[1]

You can remove it by using the --unset option of git config:

git config --global --unset use.name

See the documentation for more details.

Solution 2:[2]

git config --global --unset use.name

or you can edit config by --edit

git config --global --edit

Solution 3:[3]

Remove the section by

git config --global --remove-section use

and then

git config --global user.name "Your Name"

Solution 4:[4]

The config is stored in home directory. Try editing ~/.gitconfig

You will see something like:

[use]
        name = My name

You can change it to

[user]
        name = My name

Or you can execute the same command with correction.

Solution 5:[5]

I had multiple git accounts on my machine and only thing that worked was

git config --local --unset credential.helper
git config --global --unset credential.helper
git config --system --unset credential.helper

git config --local --unset user.name
git config --global --unset user.name
git config --system --unset user.name

git config --local --unset user.email
git config --global --unset user.email
git config --system --unset user.email

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 1615903
Solution 2 ?????
Solution 3 Rahul Katariya
Solution 4
Solution 5 Rohit