Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

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/file/.gitconfig: No such file or directory 

and the file .gitconfig is already exists, anyone have any ideas??

like image 219
codepros Avatar asked Feb 19 '13 14:02

codepros


People also ask

Why git config is not working?

Try opening it and see do this file look like this. Try setting global config through command line by- git config --global user. email "[email protected]" It automatically set the . gitconfig in the directory it needed.

Which config file is git using?

git/config file in each repository is used to store the configuration for that repository, and $HOME/. gitconfig is used to store a per-user configuration as fallback values for the . git/config file. The file /etc/gitconfig can be used to store a system-wide default configuration.

How do I change my git config file?

The global git config is simply a text file, so it can be edited with whatever text editor you choose. Open, edit global git config, save and close, and the changes will take effect the next time you issue a git command. It's that easy.


2 Answers

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.

like image 130
VonC Avatar answered Oct 17 '22 08:10

VonC


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

mkdir ~/.git

Solved the problem in my case.

like image 26
przemek Avatar answered Oct 17 '22 09:10

przemek