I\'m getting this error when trying to set the global config:
$ git config --global user.name \"Your Name Here\"
error: could not lock config file /pathto/fi
I rename the .gitconfig file as xyz.gitconfig, then git will generate a new .gitconfig file, that wokrd
I have "experienced" this error on Windows because my name (and hence %HOMEPATH%
) contains a non ascii character (é
). Either git or cmd.exe or anything else could not cope with this.
This is an old post, but I had this issue recently, but I solved the issue differently from everyone else here. I received the same error because I did not have permission to the $HOME path on my computer. Simply by accessing the folder via double-clicking through the folders in your files, I was prompted with boxes saying that I would gain permanent access to these folders after entering through them for the first time. After I accessed the deepest folder in my $HOME variable, the command worked.
I am old to the party but may be this will help some one. Thanks to @paperclip
In Windows 10:
Step 1: Go to This PC
> Right click Properties
step 2: Click Advanced System Settings
and click Environment Variables
Step 3: Under System Variables
create new variable called HOME
and input the value as %USERPROFILE%
like below
Step 4: Important You must restart your PC to take effect
Step 5: Install Git for Windows
now and optional Tortoise Git for windows
if you prefer.
Make a git clone request or try pushing something in to your repo. Magic it will work. All should work fine now.
For me, the problem was not git config, but .git directory at my current repo was created by root and I was trying to do something with my other user. I changed the perm
Check if you have a .git directory in your home folder and if you don't:
mkdir ~/.git
Solved the problem in my case.