Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fatal: unable to access 'H:\/.config/git/config': Invalid argument [Git on Windows 7]

Tags:

git

windows-7

I get this error when opening a git repository:

fatal: unable to access 'H:/.config/git/config': Invalid argument

Where in git is this path being pulled from?

'H:/.config/git/config'

I found some articles that it might be the "Home" or "UserProfile" environment variables but in my case the "Home" variable is not created and the "UserProfile" is not pointing to that path. So where is git getting that path from?

like image 428
Exocomp Avatar asked Mar 29 '14 20:03

Exocomp


People also ask

How do I change git config in Windows?

The global git config is simply a text file, so it can be edited with whatever text editor you choose. Open, edit global git config, save and close, and the changes will take effect the next time you issue a git command. It's that easy.

Why git config is not working?

Try opening it and see do this file look like this. Try setting global config through command line by- git config --global user. email "[email protected]" It automatically set the . gitconfig in the directory it needed.

How do I find my git config in terminal?

If you want to check your configuration settings, you can use the git config --list command to list all the settings Git can find at that point: $ git config --list user.name=John Doe [email protected] color.status=auto color.branch=auto color.interactive=auto color.diff=auto ...


2 Answers

I experienced a similar issue when not connected to my work network via VPN. Running the following from a command window worked for me:

net use H: /delete

This command actually deleted the H drive. If you actually use the mapped drive that is causing the issue, then this way could cause you other problems that would only be solved by remapping the drive (net use H:, followed by the mapped drive path). As a note, I did delete the HOME% variables (using "set HOME=" from the command line), but it did work until the command above was run.

like image 161
JK Dennis Avatar answered Sep 23 '22 22:09

JK Dennis


A lot of solutions were presented. Conclusion: The problem is a remote HOMEPATH and HOMEDRIVE environmental variable and appears when you are not connected to your network.

IMHO the solution with no side-effects (when your HOME variable is not set) is setting your HOME environmental variable of your profile to an existing local path.

First check if HOME is set or not. Open cmd.exe (Command prompt) and type

set HOME

If you do not get a result, just for HOMEPATH and HOMEDRIVE, than HOME is NOT set. Go to control panel:

Press WIN-R and then type control. Go to users profiles and you find a link on the left sidebar to change the environmental variable of your profile. The rest should be self-explanatory. Add variable HOME with path e.g. c:\users\myprofile.

With this attempt you could let HOMEPATH and HOMEDRIVE untouched and get no side-effects when reconnected to your network.

Worked for me.

IMPORTANT: But you lose your git settings. So you have to copy at least .gitconfig from your remote network home drive to your new local HOME directory before you disconnect from your network.

Thanks to Navjot Bhardwaj and VonC.

like image 10
Hani Avatar answered Sep 23 '22 22:09

Hani