第一次尝试安装和创建新的 git 存储库 - 我认为断开的工作网络驱动器正在创建问题

not*_*off 4 windows git installation

我安装了Windows 7。
C:\是本地驱动器。 H:\是一个工作网络驱动器,每次启动时都会不断重新安装。我已经学会了在我在家进行任何编码或安装与编码相关的应用程序时断开它,因为我往往会遇到问题。

我第一次安装了 Git 并尝试创建一个存储库。
它给了我以下错误:

error: could not lock config file H:\/.gitconfig: No such file or
directory error: could not lock config file H:\/.gitconfig: No such
file or directory
     while executing "exec {C:/Program Files/Git/libexec/git-core/git-config.exe} --global --add
 gui.recentrepo C:/Users/bmyhre/Desktop/Testing/projects/skeleton"
     ("eval" body line 1)
     invoked from within "eval exec $opt $cmdp $args"
     (procedure "git" line 23)
     invoked from within "git config --global --add gui.recentrepo $path"
     (procedure "_append_recentrepos" line 16)
     invoked from within "_append_recentrepos [pwd]"
     (procedure "_git_init" line 17)
     invoked from within "_git_init $this"
     (procedure "choose_repository::_do_new2" line 5)
     invoked from within "choose_repository::_do_new2 ::choose_repository::__o1::__d"
     invoked from within ".buttons.next invoke "
     invoked from within ".buttons.next instate !disabled { .buttons.next invoke } "
     invoked from within ".buttons.next instate pressed { .buttons.next state !pressed; .buttons.next instate !disabled { .buttons.next invoke
 } } "
     (command bound to event)
Run Code Online (Sandbox Code Playgroud)

我的猜测是它试图到达H:某个地方的驱动器(我在H:断开连接的情况下安装它),但我不知道在哪里/如何更改它,因此它实际上看起来驱动器.gitconfig上的真实C:位置。
如何避免此错误消息?

Von*_*onC 6

检查您是否定义了 %HOME% 环境变量。

如果该变量存在并引用H:\(而不是%USERPROFILE%),那么它将在(意思是)中查找全局git 配置文件。H:\.gitconfig%HOME%\.gitconfig

将该%HOME%变量更改为本地路径即可%USERPROFILE%解决该问题。