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路徑添加進去
在這裏插入圖片描述

測試

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章