Which git.exe should I reference?

陌路散爱 提交于 2020-01-22 17:51:32

问题


Git for Windows has installed four git.exe files.

They seem slightly different (comparing bytes).

Which should I use for other applications that want a reference to git.exe?

  • \Program Files\Git\bin\git.exe
  • \Program Files\Git\cmd\git.exe
  • \Program Files\Git\mingw64\bin\git.exe
  • \Program Files\Git\mingw64\libexec\git-core\git.exe

回答1:


The different version are each one for a different purpose.

  • \Program Files\Git\bin\git.exe
    This is the actual git binary which is added to your path if you run it form any script etc.

    This entry found here in the git source script for windows:
    https://github.com/git-for-windows/build-extra/blob/69c134c3c2c46bce1083d5bd4596d26543ca5f0f/portable/release.sh

  • \Program Files\Git\cmd\git.exe
    This is the git which is run when you add installed and choose to add git to your cmd (windows path)

    This entry can be found here in the source : <File Id="GitExe" Source="cmd\\git.exe" /> https://github.com/git-for-windows/build-extra/blob/69c134c3c2c46bce1083d5bd4596d26543ca5f0f/msi/release.sh

  • \Program Files\Git\mingw64\bin\git.exe
    This is the git-bash version which is used by the git-bash cygwin emulator

    It defined here in the wxs (installer file)
    https://github.com/git-for-windows/build-extra/blob/69c134c3c2c46bce1083d5bd4596d26543ca5f0f/msi/GitProduct.wxs

    <?if $(var.SixtyFourBit)=64 ?>
        <Directory Id='MingwFolder' Name='mingw64' />
    <?else?>  
    
  • \Program Files\Git\mingw64\libexec\git-core\git.exe
    Thisone is also for the emulator and is being defined here:
    https://github.com/git-for-windows/build-extra/blob/69c134c3c2c46bce1083d5bd4596d26543ca5f0f/git-extra/git-prompt.sh

    if test -z "$WINELOADERNOEXEC" then GIT_EXEC_PATH="$(git --exec-path 2>/dev/null)" COMPLETION_PATH="${GIT_EXEC_PATH%/libexec/git-core}" ...




回答2:


When you are using from your windows command prompt you should be referring to the, \Program Files\Git\bin\git.exe

The ones under mingw64 are used with the Git bash interface.



来源:https://stackoverflow.com/questions/40556003/which-git-exe-should-i-reference

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!