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

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

    This will happen, if the user home directory is not writable by the user. git config --global needs to create a "lock" file (~/.gitconfig.lock) in user home directory.

    Check the permissions and try to create one.

    # cat ~/.gitconfig.lock
    cat: /home/users/developer/.gitconfig.lock: No such file or directory
    # touch ~/.gitconfig.lock
    
    ## Now check, if a file has been created?
    # cat ~/.gitconfig.lock
    #
    

    NOTE: If it succeeds, You must delete this file, otherwise git will throw another error!

    If a user has no permission of creating this file, You must check and change permissions for the home directory.

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