在Windows 10上安装git,无法访问.gitconfig [英] Installing git on Windows 10, unable to access .gitconfig

查看:350
本文介绍了在Windows 10上安装git,无法访问.gitconfig的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是git的新手,我正尝试从此处.在安装中(很多安装中的最后一个),我选择仅从bash运行它.我现在尝试设置它,而我尝试做的第一件事就是使用

I'm new to git, and i'm trying to install git 2.9.2 from here. In the installation (the last of the many) i chose to run it from bash only. I now try to set it up, and the first thing i try is to set my name with

$ git config --global user.name "My Name"

但是执行此操作后,我得到:

But after i execute this, i get:

fatal: unable to access 'C:\Program Files\Git\ C:\Windows\system32\config\systemprofile/.config/git/config': Invalid argument

假设我现在要克隆一个存储库.我插入类似的内容:

Let's say that i now want to clone a repository. I insert something like:

git clone https://username@bitbucket.org/team/repo.git

但是我得到了

fatal: unable to access 'D:\TestRepo\ C:\Users\username/.config/git/config': Invalid argument

我认为.gitconfig文件应该位于C:/Users/username目录中,但是它试图找到C:\Users\username/.config/git/config,这似乎有点奇怪.我的HOME变量应该是%USERPROFILE%.任何帮助表示赞赏.

I thought that the .gitconfig file should be inside the C:/Users/username directory, but it tries to locate C:\Users\username/.config/git/config, which seems a little weird. My HOME variable is %USERPROFILE%, as it should. Any help appreciated.

推荐答案

相同的问题.但是,如果我使用具有管理员级别的命令外壳程序(而不是bash)运行,则git config --global -l可以工作.我的git版本 2.25.0.windows.1

Same issue. But if I run with command shell (not bash) with Admin level, git config --global -l works. My git version 2.25.0.windows.1

我注意到在Windows的System Info gui中,System的env变量的HOME条目为%USERPROFILE%.但是,用户env变量没有.我也添加了HOME.

I noticed that in the System Info gui of Windows, the env variables for System had a HOME entry of %USERPROFILE%. But, the User env variables did not. I added HOME to that too.

现在可以使用了.您可能会认为System env可以代替User中的用户.也许正在发生其他事情.

Now it works. You'd think the System env would fill in for those not in User. Maybe something else is going on.

这篇关于在Windows 10上安装git,无法访问.gitconfig的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆