Trouble setting up git with my GitHub Account error: could not lock config file

A bit like in "Trouble setting up Tower with my GitHub Account - error: could not lock config file", check how that ~/.gitconfig file has been created.
Ie: with which rights associated to it?

Make also sure your $HOME variable is correctly set when you are executing the git config --global command.


Check if you have a .git directory in your home folder and if you don't:

mkdir ~/.git

Solved the problem in my case.


I've gotten this error when a lock file exists for gitconfig. Try and find and remove .gitconfig.lock (on my linux box it was in my home dir)


just do Run as Administrator.......you need to run the program in the run as administrator mode in windows


Windows Users: Ensure your Environment Variables are correctly setup.

I had the following for my account username 'paperclip':

My Computer (right-click) > Properties > Advanced (tab) > Environment Variables (under System Variables):

HOME -> %HOMEPATH%

HOMEPATH -> C:\Documents and Settings\paperclip

It seems like Git could not resolve / expand %HOME% to %HOMEPATH% as you would it expect it to. Instead I needed to make %HOME% the same as %HOMEPATH% by changing it to:

HOME -> C:\Documents and Settings\paperclip