在尝试使用我的 GitHub 帐户设置 Git 时,每当我尝试进行全局配置时,以下错误一直存在。
它适用于存储库,但全局不起作用。
这是它的显示方式:
$ git config --global user.name "username"
error: could not lock config file C:/Path/to/.gitconfig: File exists
我在 Windows 10 专业版上使用 Git 2.21.0。
最佳答案
由于您使用的是 Windows 10,如果您的 .gitconfig 位于 C:,则可能会出现问题。如果是这种情况,请尝试以管理员权限运行您的 git bash(右键单击您的可执行文件,选择更多 > 以管理员身份运行)并查看是否有效。您需要管理员权限才能处理 C: 根目录下的文件。那对我有用。
关于git - 如何修复 Git for Windows 错误 : "could not lock config file C:/file/path/to/.gitconfig: File exists"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55327408/