简体   繁体   中英

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?

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 "Myemail@email.com"
git config --global -l

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM