user1443098
user1443098

Reputation: 7675

git config command returns: fatal: unable to read config file '%HOMEDRIVE%%HOMEPATH%/.gitconfig': No such file or directory

On My Windows 10 box, when I run:

git config --global -l

it fails with the message:

fatal: unable to read config file '%HOMEDRIVE%%HOMEPATH%/.gitconfig': No such file or directory

Both env vars look ok (to me) and .gitgconfig is where it should be I think:

C:\Users\BRITTG2>echo %homedrive%
P:

C:\Users\BRITTG2>echo %homepath%
\

C:\Users\BRITTG2>dir %homedrive%%homepath%.gitconfig
 Volume in drive P is home
 Volume Serial Number is 8076-09DA

 Directory of P:\

03/25/2019  02:34 PM               658 .gitconfig
               1 File(s)            658 bytes
               0 Dir(s)  2,908,136,849,408 bytes free

What am I missing?

Upvotes: 6

Views: 24923

Answers (2)

Rodrigo
Rodrigo

Reputation: 131

Run powershell as administrator (but you can use cmd, Git bash, etc) and try again. In my case:

cd C:\ROstuff\ROprojects\Python\
git init
git config --global user.name "Rodrigo H Padilla"
git config --global user.email "[email protected]"
git config --global -l

Upvotes: 7

user1443098
user1443098

Reputation: 7675

Found an old post (mine!) with a workaround:

git CMD finds .gitconfig but Windows cmd does not?

Bottom line: git on windows is not using homedrive and homepath. It is using the env var home. When I set that, it works

Upvotes: 3

Related Questions