我正在使用vs代码来处理我的github存储库。我尝试在Visual Studio代码中签入代码,并看到了此消息
"确保在git中配置user.name和user.email;
我试图添加user.name和user.email,但令我惊讶的是,我发现已经有了这些条目,现在我有多个user.name条目。我试图使用--replace删除它,但最终会有更多条目。我在vscode终端下做这件事。以下是快照:
user.name=--list
user.name=
username=--replace all
user.name=--replace all
我试图通过Powershell在安装的目录位置下设置git配置:
PS C:Program FilesGitbin> git config --global user.email "<my email id>"``
PS C:Program FilesGitbin> git config --list
....
....
user.name=Adil Mujeeb
user.email="<my email id>"
这一次,当我从vscode提交时,它成功了,但令我惊讶的是,它选择了错误的条目。
Author: --replace-all "<my email id>"
如何解决此问题?
首先,我们需要找出3个配置文件中哪一个有多个用户。名称行:
git config --local --get-all user.name #local repo git config file)
git config --global --get-all user.name #user config file)
git config --system --get-all user.name #system git config file)
需要修复回答多个用户名值的一个配置文件:
git config --local --replace-all user.name "User name"