简体   繁体   English

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?

To be able to run the test scripts for my cross-platform application also on Windows, I installed MSYS2 and used pacman to install any packages my test scripts rely on.为了能够在 Windows 上为我的跨平台应用程序运行测试脚本,我安装了 MSYS2 并使用 pacman 来安装我的测试脚本所依赖的任何包。

Since MSYS2 provides a port of git (msys/git), I think there is no need to install Git for Windows as well.由于 MSYS2 提供了 git (msys/git) 的端口,因此我认为没有必要为 Windows 安装 Git。 But what are the differences between the git version provided in the MSYS2 repository and the one provided by Git for Windows?但是 MSYS2 存储库中提供的 git 版本与 Git for Windows 提供的版本之间有什么区别?

I noticed these differences so far:到目前为止,我注意到了这些差异:

  1. msys/git will fail when running pip freeze on a virtualenv where a Python package from a git clone is installed in develop mode:在开发模式下安装了来自 git clone 的 Python 包的 virtualenv 上运行pip freeze时,msys/git 将失败:

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

    git-for-windows/mingw-w64-x86_64-git doesn't fail, so there are at least some differences with respect to path handling. git-for-windows/mingw-w64-x86_64-git 不会失败,因此至少在路径处理方面存在一些差异。

  2. Git for Windows's gitk and git gui work out of the box. Git for Windows 的 gitk 和 git gui 开箱即用。 There's no need to set the GIT_GUI_LIB_DIR environment variable as described here .无需按照此处所述设置GIT_GUI_LIB_DIR环境变量。

It seems git from the Git for Windows repository offers the best experience at this point.在这一点上,来自 Git for Windows 存储库的 git 似乎提供了最佳体验。

PS You can install Git for Windows's git in MSYS2 by adding the following to /etc/pacman.conf , above the [mingw32] , [mingw64] and [msys] entries. PS您可以通过添加以下为在MSYS2的Windows的混帐混帐安装/etc/pacman.conf上面[mingw32][mingw64][msys]条目。 But it might be a better idea to install the Git for Windows SDK instead, which is basically a special edition of MSYS2 including Git for Windows.但是安装 Git for Windows SDK 可能是一个更好的主意,它基本上是 MSYS2 的一个特殊版本,包括 Git for Windows。 Otherwise, the procedure below (and more) is also described here .否则, 此处描述了以下(以及更多)过程。

[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

After this (and perhaps a pacman -Sy ), you can install the Git for Windows's git:在此之后(也许还有pacman -Sy ),您可以为 Windows 的 git 安装 Git:

pacman -S mingw-w64-x86_64-git

I suppose there's no reason not to install Git for Windows's git in MSYS2?我想没有理由不在 MSYS2 中为 Windows 的 git 安装 Git?

EDIT The Git for Windows (un)installer left behind C:\\ProgramData\\Git\\config .编辑Git for Windows (un)installer 留下C:\\ProgramData\\Git\\config This points git at the wrong location for the SSL certificates.这将 git 指向 SSL 证书的错误位置。 You can remove C:\\ProgramData\\Git\\config to fix this.您可以删除C:\\ProgramData\\Git\\config来解决这个问题。

msys/git is linked against a dynamic library provided by MSYS2 to provide POSIX-to-Windows compatibility (POSIX emulation) in a manner similar to how cygwin does (MSYS2 is forked from cygwin), thus it requires the MSYS2 environment to be present to run. msys/git与 MSYS2 提供的动态库链接,以类似于 cygwin 的方式(MSYS2 从 cygwin 分叉)提供 POSIX 到 Windows 的兼容性(POSIX 仿真),因此它需要 MSYS2 环境存在跑。

git-for-windows/mingw-w64-x86_64-git on the other hand, is compiled using the MinGW compiler, which performs the translation to native Windows calls at compile time, which results in a much faster binary compared to the emulation approach, and does only require native Windows libraries to run.另一方面, git-for-windows/mingw-w64-x86_64-git是使用 MinGW 编译器编译的,该编译器在编译时执行本地 Windows 调用的转换,与仿真方法相比,这导致更快的二进制文件,并且只需要运行本机 Windows 库。

From The difference between MSYS2 and MinGW :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). MSYS2 二进制文件的 POSIX 仿真层很方便,但需要付出代价:通常,MSYS2 程序明显比它们的 MinGW 对应程序慢(如果有这样的对应程序)。 As a consequence, the Git for Windows project tries to provide as many components as possible as MinGW binaries.因此,Git for Windows 项目试图提供尽可能多的组件作为 MinGW 二进制文件。

See also: How does MSYS2 differ from Cygwin?另请参阅: MSYS2 与 Cygwin 有何不同?

git-for-windows/git issue 2688 adds a more recent (2020) perspective, from the maintainer of Git for Windows Johannes Schindelin : git-for-windows/git issue 2688添加了一个更新的(2020 年)观点,来自 Git for Windows 的维护者Johannes Schindelin

The purpose of Git for Windows is really to bring Git to Windows. Git for Windows 的目的真的是将 Git 带到 Windows。

While that implies that we have to ship quite a few Unix-like tools, it does not mean that we will include such tools unless they are needed for Git's own operations, or at least for historical reasons (needs of active contributors are sometimes a factor in deciding whether to include a tool or not).虽然这意味着我们必须发布相当多的类 Unix 工具,但这并不意味着我们将包含这些工具,除非 Git 自己的操作需要它们,或者至少出于历史原因(活跃贡献者的需求有时是一个因素)决定是否包含工具)。

Having said that, what you really are looking for is MSYS2 .话虽如此,您真正要寻找的是MSYS2
Git for Windows leverages MSYS2 and ships with a subset of its files. Windows 版 Git 利用 MSYS2 并附带其文件的子集。 MSYS2 even sports a package management system called " pacman " to install more tools (including Git...). MSYS2 甚至运行一个名为“ pacman ”的包管理系统来安装更多工具(包括 Git...)。

The documentation is " Install inside MSYS2 proper " as noted in the question, but it has recently changed, since Pacboy is removed from the base installation .如问题中所述,文档是“ 在 MSYS2 中正确安装”,但最近已更改,因为Pacboy 已从基本安装中删除

So it needs to be added back with:所以它需要添加回来:

# pacman -Fy
:: Synchronizing package databases...
[...]
# pacman -F pacboy.exe
# pacman -F pacboy
msys/pactoys-git r2.07ca37f-1 (base base-devel)
    usr/bin/pacboy
    usr/share/bash-completion/completions/pacboy

Then:然后:

Copying /var/lib/pacman/local files over from my msys2 installation into git-bash 's, I was able to install tmux (as I planned/showed in OP), and it is working fine for me./var/lib/pacman/local文件从我的msys2安装msys2git-bash ,我能够安装tmux (正如我在 OP 中计划/显示的那样),它对我来说工作正常。

So, having /var/lib/pacman/local files is all it take for msys2 and pacman to work within git-bash (I meant git-for-windows).因此,只要拥有/var/lib/pacman/local文件, msys2pacman就可以在git-bash (我的意思是 git-for-windows)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何为Windows 7 x64构建64位Qt 5.3? 使用MinGW-w64和MSVS构建之间有什么区别吗? - How to build 64bit Qt 5.3 for Windows 7 x64? Is there any differences between builds with MinGW-w64 and MSVS? x86_64-w64-mingw32中的setjmp / longjmp - setjmp/longjmp in x86_64-w64-mingw32 Windows 10 错误:与“x86_64-w64-mingw32-gcc”链接失败:退出代码:1 - Windows 10 error: linking with `x86_64-w64-mingw32-gcc` failed: exit code: 1 Heroku可以在Windows上使用Git的x64安装吗? - Can Heroku use x64 installation of Git on Windows? 更改Git-Bash中的目录:在Windows机器上使用MINGW64中的Windows样式目录地址 - Changing directory in Git-Bash: using Windows-style directory addresses in MINGW64 on Windows machines MSYS2:集成 Git-For-Windows 后,我在 MSYS2 启动时收到此错误:bash: create-shortcut.exe: command not found - MSYS2: After integrating Git-For-Windows, I'm getting this error at MSYS2 startup: bash: create-shortcut.exe: command not found Python getpass在Windows Git Bash(MINGW64)上不起作用 - Python getpass doesn't work on Windows Git Bash (MINGW64) x86_64-w64-mingw32 / bin / ld.exe:找不到-lgmp - x86_64-w64-mingw32/bin/ld.exe: cannot find -lgmp 64位Windows 2012 Server上正确的Git路径是什么? - What is the correct Git path on 64 bit windows 2012 server? 为什么我的 Git bash 上出现“MINGW64”? - Why is "MINGW64" appearing on my Git bash?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM