我在git中运行了一个全局配置命令,使用.gitignore_global文件排除某些文件:

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

是否有办法全局撤销此设置的创建?


当前回答

你可以使用git配置的——unset标志来这样做:

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

如果一个配置有多个变量,你可以使用:

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

其他回答

您可以使用检查所有配置设置

git config --global --list

您可以删除设置,例如username

git config --global --unset user.name

您可以手动编辑配置或删除配置设置,使用:

git config --global --edit 

这将取消设置全局凭据帮助。

git config --global --unset credential.helper

Git配置信息将存储在~/中。Unix平台上的Gitconfig。

在Windows中,它将存储在C:/users/<NAME>/.gitconfig中。

您可以通过打开这些文件并删除您感兴趣的字段来手动编辑它。

尝试从命令行更改git配置细节。

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

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

尝试这些命令删除所有用户的用户名和电子邮件。

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