在我的Windows 10机器上,当我运行:
git config --global -l
它会失败,并显示以下消息:
致命错误:无法读取配置文件'%HOMEDRIVE%%HOMEPATH%/.gitconfig':没有这样的文件或目录
两个env变量看起来都不错(对我来说),.gitgconfig应该在我认为的位置:
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
我遗漏了什么?
发布于 2019-04-22 23:52:26
找到一个旧帖子(我的!)使用解决方法:
git CMD finds .gitconfig but Windows cmd does not?
结论: windows上的git没有使用homedrive和homepath。它正在使用env var home。当我设置它的时候,它起作用了
发布于 2020-05-31 20:13:09
以管理员身份运行powershell (但您可以使用cmd、Git bash等),然后重试。在我的例子中:
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
https://stackoverflow.com/questions/55797060
复制相似问题