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

后端 未结 19 1590
甜味超标
甜味超标 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:13

    I rename the .gitconfig file as xyz.gitconfig, then git will generate a new .gitconfig file, that wokrd

    0 讨论(0)
  • 2020-11-28 06:14

    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.

    0 讨论(0)
  • 2020-11-28 06:14

    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.

    0 讨论(0)
  • 2020-11-28 06:14

    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.

    0 讨论(0)
  • 2020-11-28 06:15

    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

    0 讨论(0)
  • 2020-11-28 06:17

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

    mkdir ~/.git

    Solved the problem in my case.

    0 讨论(0)
提交回复
热议问题