我在git中运行了一个全局配置命令,使用.gitignore_global文件排除某些文件:
git config --global core.excludesfile ~/.gitignore_global
Run Code Online (Sandbox Code Playgroud)
有没有办法撤消全局创建此设置?
lar*_*sks 463
我不确定你是什么意思"撤消"改变.你可以删除这样的core.excludesfile设置:
git config --global --unset core.excludesfile
Run Code Online (Sandbox Code Playgroud)
当然,您只需编辑配置文件:
git config --global --edit
Run Code Online (Sandbox Code Playgroud)
...然后手动删除设置.
Sam*_*ogo 24
为了补充 larsk anwser,可以在使用 vim 进行编辑时使用 dd 命令删除输入行:
git config --global --edit
Run Code Online (Sandbox Code Playgroud)
然后:
dd并按 Enter 键删除该行。完成后,输入ESQ并:wq
Shi*_*pta 18
您可以使用检查所有配置设置
git config --global --list
Run Code Online (Sandbox Code Playgroud)
您可以删除设置,例如用户名
git config --global --unset user.name
Run Code Online (Sandbox Code Playgroud)
您可以使用以下命令手动编辑配置或删除配置设置:
git config --global --edit
Run Code Online (Sandbox Code Playgroud)
小智 17
您可以像这样使用--unset标志git config:
git config --global --unset user.name
git config --global --unset user.email
Run Code Online (Sandbox Code Playgroud)
如果您有一个配置的更多变量,您可以使用:
git config --global --unset-all user.name
Run Code Online (Sandbox Code Playgroud)
Pra*_*thi 13
从命令行尝试此更改git配置详细信息.
git config --global --replace-all user.name "Your New Name"
git config --global --replace-all user.email "Your new email"
Run Code Online (Sandbox Code Playgroud)
小智 13
这将重置全局凭证助手。
git config --global --unset credential.helper
Run Code Online (Sandbox Code Playgroud)
小智 10
如果有人只想user完全删除该对象,那么他应该使用:
git config --global --remove-section user
Run Code Online (Sandbox Code Playgroud)
当用户意外添加更多不需要的属性(例如user.password等)时,这非常有用。
打开配置文件进行编辑:
git config --global --edit
Run Code Online (Sandbox Code Playgroud)
单击Insert并删除该设置
最后输入:wq并Enter保存.
小智 7
尝试这些命令来删除所有用户的用户名和电子邮件。
git config --global --unset-all user.name
git config --global --unset-all user.email
Run Code Online (Sandbox Code Playgroud)
小智 5
git配置信息将存储在~/.gitconfigunix平台中。
在 Windows 中,它将存储在C:/users/<NAME>/.gitconfig.
您可以通过打开此文件并删除您感兴趣的字段来手动编辑它。