尝试设置全局配置时出现此错误:
$ git config --global user.name "Your Name Here"
error: could not lock config file /pathto/file/.gitconfig: No such file or directory
Run Code Online (Sandbox Code Playgroud)
并且文件 .gitconfig 已经存在,有人有任何想法吗??
Sal*_*lem 17
看看这些提示是否对您有帮助:
验证是否有一些名为~/.gitconfig.lock. 如果是这种情况,只需删除它。
该文件~/.gitconfig属于您(用于ls -la ~/.gitconfig检查)。如果不是,您可以使用更改所有权sudo chown <your_username>:<your_username> ~/.gitconfig
如果这些都不能解决问题,您始终可以使用您喜欢的文本编辑器编辑 ~/.gitconfig。它只是一个类似 INI 的文件。一个例子:
$ cat ~/.gitconfig
[user]
name = my_username
email = me@email.com
[core]
editor = editor
pager = most
[color]
ui = auto
[merge]
conflictstyle = diff3
Run Code Online (Sandbox Code Playgroud)
我假设正确的位置是~/.gitconfig. 如果不是这种情况,请将其替换为正确的路径。
希望能帮助到你。
| 归档时间: |
|
| 查看次数: |
121956 次 |
| 最近记录: |