My Git installation always refers to the wrong directory. Why?

后端 未结 1 1538
感动是毒
感动是毒 2020-12-06 15:06

I installed and re-installed Git on my Windows8 machine multiple times. It\'s a long story as to why I did that. Once I installed it at C:\\Git and now I

相关标签:
1条回答
  • 2020-12-06 15:38

    This is linked to the value of the environment variable HOME.

    • make sure you don't have one defined in your windows session.
    • use the git-cmd.bat which comes with your msysgit (obsolete since early 2015)
      use the git-cmd.exe which comes with your git-for-windows:
      it will set HOME to the right value, and will be able to look for/ or create %HOME%/.ssh and other config files which reside in %HOME% directory.

    With the old msysgit, that git-cmd.bat contains:

    @if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH%
    @if not exist "%HOME%" @set HOME=%USERPROFILE%
    

    With the new git-for-windows, the git.exe is build with:

    --cd-to-home"; WorkingDir: %HOMEDRIVE%%HOMEPATH%
    

    In both cases, HOME is set to, by default, %HOMEDRIVE%%HOMEPATH%.

    0 讨论(0)
提交回复
热议问题