13

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.

bin1six
  • 167
  • 1
  • 1
  • 7
  • Rewrite the command to replace the incorrect config. – gzh Feb 04 '16 at 05:38
  • user.name is indeed there, but I was hoping to remove use.name. Or am I misunderstanding? Thanks. – bin1six Feb 04 '16 at 05:44
  • then edit your ~/.gitconfig to delete use section. – gzh Feb 04 '16 at 05:52
  • Possible duplicate of [How can I remove an entry in global configuration with git config?](http://stackoverflow.com/questions/11868447/how-can-i-remove-an-entry-in-global-configuration-with-git-config) – Andrew C Feb 04 '16 at 06:02

5 Answers5

22

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

git config --global --unset use.name

See the documentation for more details.

1615903
  • 32,635
  • 12
  • 70
  • 99
6
git config --global --unset use.name

or you can edit config by --edit

git config --global --edit
1

Remove the section by

git config --global --remove-section use

and then

git config --global user.name "Your Name"
Rahul Katariya
  • 3,528
  • 3
  • 19
  • 24
0

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.

Anurag Peshne
  • 1,547
  • 12
  • 29
  • Thanks, assuming you mean for me to open gitconfig in text edit, I don't see my "[use]" category there. Only "[user]." Perhaps there is a command I can use to get rid of [use]? – bin1six Feb 04 '16 at 05:41
  • @bin1six: as mentioned by other users, you can unset it – Anurag Peshne Feb 04 '16 at 05:44
0

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
Rohit
  • 6,365
  • 14
  • 59
  • 90