git config :.../.gitconfig:No such file or directory

.../.gitconfig:No such file or directory

申明

借鉴文章出处:https://blog.csdn.net/Anerror/article/details/80550318

问题是什么?

今天遇见了一个问题,就是我git add . 之后,准备git commit -m "delete OS/Java file" 的时候他报了一个错,大概意思如下:

tell me what you are, you can use git config --global user.name yourname,and git config --global user.email youremail

可是在我使用这两句命令的时候,它又报了一个错,

error:could not lock config file .../.gitconfig:No such file or directory

意思就是它没有找到一个叫.gitconfig 的文件,虽然你电脑上有这个文件。

如何解决?

.gitconfig 添加到HOME环境变量。

操作

1、我的.gitconfigC:\Users\lenovo 下(lenovo是我电脑的用户名,我的电脑是有.gitconfig 文件的,如果没有手动新建一个)
2、新建系统变量,将.gitconfig路径添加进去
在这里插入图片描述

测试

在这里插入图片描述

发布了30 篇原创文章 · 获赞 21 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/weixin_41288824/article/details/97931532