如何删除git配置?,

k2arahey  于 2024-01-04  发布在  Git
关注(0)|答案(6)|浏览(207)

基本上,我输入:

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

字符串
请注意,我写的是“use.name“而不是“user.name”。但现在该字段在那里,所以我想知道如何删除它。

x9ybnkn6

x9ybnkn61#

你可以使用git config的--unset选项来删除它:

git config --global --unset use.name

字符串
请参阅documentation以了解更多详细信息。

5n0oy7gb

5n0oy7gb2#

git config --global --unset use.name

字符串
或者你可以通过--edit来编辑配置

git config --global --edit

jutyujz0

jutyujz03#

删除该节,

git config --global --remove-section use

字符串
然后

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

ukdjmx9f

ukdjmx9f4#

配置存储在主目录中。尝试编辑~/.gitconfig
你会看到类似这样的东西:

[use]
        name = My name

字符串
您可以将其更改为

[user]
        name = My name


或者你也可以执行同样的命令,但需要更正。

kqhtkvqz

kqhtkvqz5#

我在我的机器上有多个git帐户,唯一有效的是

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

字符串

myss37ts

myss37ts6#

在全局git配置中取消用户名的Git命令:

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

字符串

相关问题