msys / git和git-for-windows / mingw-w64-x86_64-git有什么区别?

What are the differences between msys/git and git-for-windows/mingw-w64-x86_64-git?

为了能够在Windows上也为我的跨平台应用程序运行测试脚本,我安装了MSYS2,并使用pacman安装了测试脚本所依赖的任何软件包。

由于MSYS2提供了git(msys / git)端口,因此我认为也无需为Windows安装Git。但是,MSYS2存储库中提供的git版本与Git for Windows提供的git版本有什么区别?

到目前为止,我注意到了这些差异:

  • 在virtualenv上运行pip freeze时,msys / git将失败,在virtualenv上以开发模式安装了git clone的Python软件包:

    1
    FileNotFoundError: [WinError 3] The system cannot find the path specified: '/c/users/user/documents/project/.git\\..'

    git-for-windows / mingw-w64-x86_64-git不会失败,因此在路径处理方面至少存在一些差异。

  • Windows的gitk和git gui的Git开箱即用。无需按此处所述设置GIT_GUI_LIB_DIR环境变量。

  • 到目前为止,Git for Windows存储库中的git似乎提供了最佳体验。

    附言您可以通过在[mingw32][mingw64][msys]条目上方的/etc/pacman.conf中添加以下内容,在MSYS2中安装Windows git的Git。但是,最好改为安装Git for Windows SDK,这基本上是MSYS2的特殊版本,包括Windows Git。否则,此处还将介绍以下步骤(及更多步骤)。

    1
    2
    3
    4
    5
    [git-for-windows]
    Server = https://dl.bintray.com/$repo/pacman/$arch

    [git-for-windows-mingw32]
    Server = https://dl.bintray.com/git-for-windows/pacman/i686

    之后(可能是pacman -Sy),您可以为Windows的git安装Git:

    1
    pacman -S mingw-w64-x86_64-git

    我想没有理由不在MSYS2中为Windows的git安装Git吗?

    编辑C:\ProgramData\Git\config后面的Windows Git(卸载)安装程序。这将git指向SSL证书的错误位置。您可以删除C:\ProgramData\Git\config来解决此问题。


    msys / git与MSYS2提供的动态库链接,以类似于cygwin的方式(Mcy2是从cygwin派生的)的方式提供POSIX到Windows的兼容性(POSIX仿真),因此它需要存在MSYS2环境。 跑。

    另一方面,git-for-windows / mingw-w64-x86_64-git是使用MinGW编译器进行编译的,该编译器在编译时会将其转换为对本机Windows的调用,与模拟方法相比,二进制文件的速度要快得多, 并且只需要运行本机Windows库即可。

    从MSYS2和MinGW之间的区别:

    The POSIX emulation layer of MSYS2 binaries is convenient, but comes at a cost: Typically, MSYS2 programs are noticably slower than their MinGW counterparts (if there are such counterparts). As a consequence, the Git for Windows project tries to provide as many components as possible as MinGW binaries.

    另请参阅:MSYS2与Cygwin有何不同?