如何删除 git 配置



基本上,我输入:

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

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

您可以使用

git config 的--unset选项将其删除:

git config --global --unset use.name

有关更多详细信息,请参阅文档。

git config --global --unset use.name

或者你可以通过 --edit 编辑

配置。
git config --global --edit

删除该部分

git config --global --remove-section use

然后

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

配置存储在主目录中。尝试编辑~/.gitconfig

您将看到类似以下内容:

[use]
        name = My name

您可以将其更改为

[user]
        name = My name

或者,您可以执行相同的命令并进行更正。

我的机器上有多个 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

最新更新