“Git error: could not lock config file C:/Users/old_profile/.gitconfig: No such file or directory” after profile migration

后端 未结 5 2022
日久生厌
日久生厌 2020-12-15 11:21

I have an interesting error that keeps coming up when using git for windows (version 2.12.0.windows.1). I recently migrated my windows profile directory from one location to

相关标签:
5条回答
  • 2020-12-15 12:02

    My problem was the same:

    “Git error: could not lock config file C:/<Name_file>/.gitconfig: No such file or directory”

    1. I saw that "C:/<...>/" no any files, and I found file ".gitconfig" in C:/Users/profile/.gitconfig
    2. I did copy-paste .gitconfig to C:/<...> and reload PC, after Run git as Administrator and all worked correct.
    0 讨论(0)
  • 2020-12-15 12:06

    I faced similar issue.

    Error: could not lock config file C:/.gitconfig:

    Solution: I had a system environment variable (Home= C:\ ) in my computer and it caused this issue. Deleted it and everything started working.

    0 讨论(0)
  • 2020-12-15 12:15

    This was being caused by bad paths in my environment variables (due to the profile migration).

    I opened up System Properties -> Environment Variables, and updated all references to C:\Users\<old_profile> with the new one.

    0 讨论(0)
  • 2020-12-15 12:21

    In WSL / bash

    Use sudo to set values. This should only apply to the --system scope.

    sudo git config --system diff.tool p4merge
    

    In Cmd / PowerShell

    Run as Administrator to set values. This is because the gitconfig file (probably located at: C:\Program Files\Git\mingw64\etc\) is protected.

    Only SYSTEM and COMPUTER\Administrators have Modify rights. The rest of the ACLs have Read and Read & execute rights only.

    0 讨论(0)
  • 2020-12-15 12:22

    this can be due to using multiple git account on visual studio. Check if you are logged in with correct credentials.

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