Git config not working #22483
-
I have used git and github on this computer I am currently using (Windows 10), many times before, but I had not used it for a couple months. When I tried to make a commit to a new repository yesterday, it prompted me to do the git config --global user.email, and when I enter that, I get this error: error: could not lock config file C:/ProgramData/SPB_Data/.gitconfig: No such file or directory I followed that path and found there is no SPB_Data folder there (including hidden files). Also I found that my .gitconfig file is located in C:/Users/cwolf. I don’t know if solving the problem is as simple as making a SPB_Data folder and putting that .gitconfig file in it, but I don’t want to try that if I don’t know what I’m doing. My question is what do I need to do to get the git config working again, and why did this happen if everything used to be working a couple months ago, same computer, same operating system? |
Beta Was this translation helpful? Give feedback.
Replies: 13 comments
-
As you stated you are using Windows 10. It’s look like your .gitconfig is broken.
If still it doesn’t work, THEN
wolfenstein11x:
This MAY happen because you updated your git/system and something unexpected happen or any app misbehaved with your git. |
Beta Was this translation helpful? Give feedback.
-
This is what my .gitconfig file looks like, located in C:\Users\cwolf: [user] And the file in C:\ProgramData\Git just called “config” looks like this: [core] I am going to try uninstalling and reinstalling Git now, and I hopefully that works |
Beta Was this translation helpful? Give feedback.
-
darkRaspberry:
Did u try this. If |
Beta Was this translation helpful? Give feedback.
-
I just uninstalled Git and then reinstalled it, and tried a git config again, same error: |
Beta Was this translation helpful? Give feedback.
-
Maybe some environment variables have been changed on your system. see is there any changed then return those to default |
Beta Was this translation helpful? Give feedback.
-
Ok I just straight up made a new folder called SPB_Data and copy and pasted my .gitconfig file into it, and that worked. |
Beta Was this translation helpful? Give feedback.
-
Yup but just check the enviroment variable. The git is considering home as |
Beta Was this translation helpful? Give feedback.
-
USERPROFILE=C:\Users\cwolf but then HOME=C:\ProgramData\SPB_Data Ok just to make sure I don’t accidentally break something, what’s the best way to reset that one environment variable |
Beta Was this translation helpful? Give feedback.
-
Just edit it. This is the culprit. NOOB HINT- Keep a eye on slash ( |
Beta Was this translation helpful? Give feedback.
-
Thank you for your help. You guys are way more chill than the people on stack overflow |
Beta Was this translation helpful? Give feedback.
-
Did you tried changing the environment variable? Did it worked? Mark this question as solved if satisfied. Or drop a like. |
Beta Was this translation helpful? Give feedback.
-
Had the same problem on Win10. Solved by changing windows env variable ‘HOME’ to Seems as though git usings this env variable as its base directory |
Beta Was this translation helpful? Give feedback.
-
Hi, there had been so much time, but I wanted to solved your problem. I opened SPB_Data File where git was setted, like that the problem was solved. By the way, seen .git file in SPB_Data file when I opened this. Best regards! See you. |
Beta Was this translation helpful? Give feedback.
Just edit it. This is the culprit.
May be you installed some app in recent day. And you given admin privilege and the app changed the path. Just change it and it will set everything good for any app that depend on home directory for config like git or node.
NOOB HINT- Keep a eye on slash (
/
‘’) both are different.