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

混江龙づ霸主 提交于 2019-11-29 02:34:19
Jerin

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.

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.

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

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!