Git warning: unable to access 'P:\\/.gitconfig': Invalid argument

假装没事ソ 提交于 2019-12-03 04:19:49

I just encountered this error.
Executing set HOMEPATH in the command line gave this output:

HOMEPATH=\

Simply deleting this environment variable via set HOMEPATH= fixed the problem.

I experienced a similar issue when not connected to my work network via VPN. Deleting the all the HOME% variables did not work. Deleting the network drive it was trying to access did work. Running the following from a command window worked for me:

net use H: /delete

As a note, I did delete the HOME% variables, but it did work until the command above was run.

I hit on this and had to set HOMEDRIVE to something sane.

e.g.

set HOMEDRIVE=D:

I was facing this issue when loading a solution in Visual Studio 2017 (v15.1) running as an Administrator. And my local git repo was located in C:\Code\

To work around the problem,

  1. I added an Environment Variable (under User variable) HOME with value C:\
  2. Restarted Visual Studio (again as an admin) - this time Git was able to load successfully loading my branch & source control association correctly.

Try running as Administrator. For whatever reason it defaults to a mapped drive.

If you are using "Git Bash" (MINGW64) on Windows:

Enter:

export HOME=/c

To verify:

echo $HOME

It works for me to clear the HOME Variable "nearly" to Daniels solution:

set HOME=

To recheck you have to echo it like this:

echo %HOME%

For me, I have seen this error in sourcetree, it was just a matter of disconnecting the drive P in my computer as it was a net drive.

I experienced this error message intermittently.

The cause was a VPN connection that I used occasionally. It was blocking access to my networked HOMEDRIVE every time I used it; and git could no longer access the config file.

Clearly not the cause here because you found your solution, but I thought I'd add it here for anyone else searching.

Thanks @daniel-hilgrath, your answer helped me till an extent, it did solve for that particular session.

But in my case I was using SourceTree and on Windows 7. I had to wipe out the Environment variables completely, not only for particular session. I did following.

SETX HOMEPATH ""
SETX HOMEDRIVE ""

may be this could be useful for someone who is using this on SourceTree.

Pr1nz

For the PowerShell users out there:

Remove-Item Env:\HOMEPATH

Thank you @Daniel Hilgarth for the answer

I was getting the same error for sourceTree. Setting the HOME environment variable with value C:\ fixed the issue.

This worked for me on windows 10.

My source code is in C:\workspace and I added an environment variable **HOME to C:**

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