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

后端 未结 19 1657
甜味超标
甜味超标 2020-11-28 05:52

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         


        
19条回答
  •  醉酒成梦
    2020-11-28 06:25

    In my case, the .git/config file was created not in my $HOME directory, but inside my repository on .git/config.lock

    Deleting the file fixed the problem. The file is created, when I switch branches with git checkout -f branchname and files from a recently created submodule were overwritten by git checkout.

    $ git branch --set-upstream-to=origin/branchname
    error: could not lock config file .git/config: File exists
    error: Unable to write upstream branch configuration
    hint: 
    hint: After fixing the error cause you may try to fix up
    hint: the remote tracking information by invoking
    hint: "git branch --set-upstream-to=origin/branchname".
    

提交回复
热议问题