【发布时间】:2013-02-19 14:32:39
【问题描述】:
我在尝试设置全局配置时遇到此错误:
$ git config --global user.name "Your Name Here"
error: could not lock config file /pathto/file/.gitconfig: No such file or directory
.gitconfig 文件已经存在,有人有什么想法吗?
【问题讨论】:
-
这是在哪个操作系统上? (看起来 Git 无法正确解析您的 $HOME 或 $USER?还是您自己将那个“用户名”放在那里?)
-
你对
.gitconfig有正确的权限吗? -
-rw-rw-r-- 1 .gitconfig
-
mkdir ~/.git; cd ~; git config ...应该可以解决问题。重要的部分是当你运行 git config 时,你应该在包含.git的目录中(例如你的主路径)。
标签: git