Chris G.
Chris G.

Reputation: 25984

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

I am just testing git. I ran the following command:

git config user.email "[email protected]"

I now get this when git status and others:

C:\gitg\g1>git status
warning: unable to access 'P:\/.gitconfig': Invalid argument
warning: unable to access 'P:\/.gitconfig': Invalid argument
warning: unable to access 'P:\/.gitconfig': Invalid argument
# On branch master
warning: unable to access 'P:\/.gitconfig': Invalid argument
nothing to commit, working directory clean

C:\gitg\g1>

Upvotes: 31

Views: 52167

Answers (16)

Preeja
Preeja

Reputation: 1

  • delete the .gitconfig file at the remote drive (H or P)location
  • do a git init at any location you choose - this will add the configs to .git folder at the location (example D:\yourCode.git) The above steps helped me to resolve the issue I faced.

Upvotes: 0

Winston Fan
Winston Fan

Reputation: 1

Just a note that, before trying all the abovementioned methods such as delete H drive, remove home path etc. Since I found someone was mentioning about VPN and I realized that I was working on my company's laptop and it did have a VPN.

So I fixed my problem by simply disconnected and re-connected the VPN and everything started working.

It makes sense because that I know I did not change anything and it was working yesterday, but stopped working today, so it might be related to the VPN was not successfully launched today, so this led to the thought that I probably should re-start the VPN connection. Which is way much easier and safer and should be tried first.

Upvotes: 0

CodeEnhancer
CodeEnhancer

Reputation: 31

Issue On Windows 10, I had similar issue with H:\.gitconfig file. Trying to access the file was failing. Trying to delete the file was giving Error 0x800710FE.

Searching Error 0x800710FE found this explanation.

Windows 10 sometimes shows weird errors and 0x800710FE is one that appears when you delete a file or folder. Basically, it is a native Office File Synchronization issue that occurs in Win 10, though not enabled by default.

Solution Disconnecting network drive (H:) and trying to connect to git worked.

Upvotes: 0

CuriousGuy
CuriousGuy

Reputation: 4138

This worked for me on windows 10.

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

enter image description here

Upvotes: 3

Darshna
Darshna

Reputation: 201

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

Upvotes: 2

Pr1nz
Pr1nz

Reputation: 91

For the PowerShell users out there:

Remove-Item Env:\HOMEPATH

Thank you @Daniel Hilgarth for the answer

Upvotes: 1

Hiren
Hiren

Reputation: 774

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.

Upvotes: 0

Naren
Naren

Reputation: 827

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.

Upvotes: 9

Hasson
Hasson

Reputation: 1914

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.

Upvotes: 3

kashiraja
kashiraja

Reputation: 758

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

Enter:

export HOME=/c

To verify:

echo $HOME

Upvotes: 12

JK Dennis
JK Dennis

Reputation: 661

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.

Upvotes: 17

Steve T
Steve T

Reputation: 53

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.

Upvotes: 2

Shavelieva
Shavelieva

Reputation: 63

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

Upvotes: 6

David Victor
David Victor

Reputation: 827

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

e.g.

set HOMEDRIVE=D:

Upvotes: 9

Tobias Oberrauch
Tobias Oberrauch

Reputation: 226

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%

Upvotes: 3

Daniel Hilgarth
Daniel Hilgarth

Reputation: 174457

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.

Upvotes: 49

Related Questions