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

40,447

Solution 1

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.

Solution 2

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.

Solution 3

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

Enter:

export HOME=/c

To verify:

echo $HOME

Solution 4

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

e.g.

set HOMEDRIVE=D:

Solution 5

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.
Share:
40,447
Chris G.
Author by

Chris G.

Updated on November 19, 2021

Comments

  • Chris G.
    Chris G. over 2 years

    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>