msysgit 和 Cygwin + git 之间的区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3144082/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 08:38:37  来源:igfitidea点击:

Difference between msysgit and Cygwin + git?

gitcygwinmsysgit

提问by why

What is the difference between msysgit and Cygwin + git?

msysgit 和 Cygwin + git 有什么区别?

Now I'm using msysgit, but I don't like the Git Bash (you can't resize or copy/paste) so I'm thinking think about switching to Cygwin, because then I could use mintty.

现在我正在使用 msysgit,但我不喜欢 Git Bash(你不能调整大小或复制/粘贴)所以我正在考虑切换到 Cygwin,因为那样我可以使用mintty

回答by VonC

Edit 2018:

2018年编辑:

Since my 2010-2012-2014 answer, in 2015 Git for Windows uses msys2, as I detail here.

自从我的 2010-2012-2014 回答以来,2015 年 Git for Windows 使用 msys2,正如我在此处详述的

See more in "How are msys, msys2, and msysgit related to each other?".

请参阅“ msys、msys2 和 msysgit 之间有何关联?”。



Edit (2 more years later: October 2014)

编辑(2 年后:2014 年 10 月)

Johannes Schindelinjust explained(Oct. 2014) that msysgit is phased out:

Johannes Schindelin刚刚解释说(2014 年 10 月)msysgit 已被淘汰

We now have a light-weight Git for Windows SDK– which is essentially a standard MinGW/MSys system managed through the package manager mingw-get.

We decided to just phase out the name "msysGit" (as well as the GitHub org of the same name) and:

  • work on Git for Windows(with the corresponding GitHub org),
  • using the name "Git for Windows" for the installer aimed at "end-users" and
  • using the name "Git for Windows SDK" for the development environment targeting Git for Windows developers).

我们现在有一个用于 Windows SDK轻量级 Git——它本质上是一个标准的 MinGW/MSys 系统,通过包管理器 mingw-get 进行管理。

我们决定逐步淘汰名称“msysGit”(以及同名GitHub 组织),并且:

  • 使用Git for Windows(使用相应的 GitHub 组织)
  • 使用名称“ Git for Windows”作为针对“最终用户”的安装程序和
  • 对于面向 Windows 开发人员的 Git 的开发环境使用名称“ Git for Windows SDK”)。


Update 2 years later: July 2012

2 年后更新:2012 年 7 月

Msysgit is here to stay, and unless you needto add a few hundreds of MB for cygwin, you really don't need Cygwin to just use Git on Windows.
And if you want to access GitHub, you get one package ("Git for Windows" + ssh keys registered for you on your GitHub account + a nice GUI) with GitHub for windows.

Msysgit在这里留下来,除非你需要加几百MB的Cygwin的,你真的不需要Cygwin的只是使用的Git在Windows上。
如果你想访问 GitHub,你会得到一个带有GitHub for windows 的包(“Git for Windows”+在你的 GitHub 帐户上为你注册的 ssh 密钥+一个漂亮的 GUI)。

Both Gitand msysgitare on GitHub.
The msysgit.github.compage clearly illustrates the difference between:

双方的Gitmsysgit是在GitHub上。
msysgit.github.com页清楚地说明之间的区别:

Git for Windows logo<---------->MsysGit logo
"Git for Windows": Pure users of Git | "MsysGit": for Testers, developers, custom installer maintainers

Windows 版 Git 徽标<---------->MsysGit 徽标
Git for Windows”:Git 的纯用户 | “ MsysGit”:适用于测试人员、开发人员、自定义安装程序维护人员

See also the msysgit FAQ:

另请参阅msysgit 常见问题解答

What is this "MSys" thing in "MSysGit"?

MSys is an environment for Windows offering a Unix-type shell and a Perl interpreter. Because many parts of Git are still not builtins programmed in C, but instead shell and Perl scripts, Git for Windows needs such an environment.

Therefore we ship Git for Windows with a very minimal version of MSys.

MSys is also required to build Git, as we re-use the same Unix-type setup upstream Git uses. We ship a more complete MSys environment, including GCC, as build environment (which is therefore nick-named ''msysGit'').

We compile Git as a pure MinGWprogram, though, i.e. a program without any link-dependencies on anything but standard Windows libraries.
So unless you need to use any parts of Git that are still implemented only as shell or Perl scripts, you can get away with running plain git.exe.

“MSysGit”中的“MSys”是什么东西?

MSys 是一个 Windows 环境,提供了一个 Unix 类型的 shell 和一个 Perl 解释器。因为 Git 的很多部分仍然不是用 C 编写的内置程序,而是用 shell 和 Perl 脚本,所以 Windows 版 Git 需要这样的环境。

因此,我们将 Git for Windows 与一个非常小的 MSys 版本一起发布。

MSys 也需要构建 Git,因为我们重用上游 Git 使用的相同 Unix 类型设置。我们提供了一个更完整的 MSys 环境,包括 GCC,作为构建环境(因此昵称为“msysGit”)。

不过,我们将 Git 编译为一个纯粹的MinGW程序,即一个除了标准 Windows 库之外没有任何链接依赖关系的程序。
因此,除非您需要使用仍然仅作为 shell 或 Perl 脚本实现的 Git 的任何部分,否则您可以运行普通的 git.exe。



Original answer: June 2010

原答案:2010 年 6 月

a/ You can resize and copy-paste in Git bash, like in any other Windows Shell.

a/ 您可以在 Git bash 中调整大小和复制粘贴,就像在任何其他 Windows Shell 中一样。

b/ You are probably using "Git for windows", and not msysgit. From the wiki:

b/ 您可能使用的是“Windows 版 Git”,而不是 msysgit。从维基

  • msysGit is the development environment to compile Git for Windows. It is complete, in the sense that you just need to install msysGit, and then you can build Git. Without installing any 3rd-party software.
  • Git for Windows is an installer which installs Git -- and only Git.

It is easy to see the difference:

  • the installers for Git have the prefix Git-,
  • the msysGit installers have the prefix msysGit-.

Another telltale is that the msysGit installers come in two flavors: fullinstall and netinstall.
Further, msysGit does not install to C:\Program Filesby default.
But msysGit comes with gcc, the GNU C Compiler.

  • msysGit 是为 Windows 编译 Git 的开发环境。它是完整的,从某种意义上说,您只需要安装 msysGit,然后就可以构建 Git。无需安装任何第三方软件。
  • Windows 版 Git 是一个安装程序,它安装 Git —— 并且只安装 Git

很容易看出区别:

  • Git 的安装程序有前缀 Git-,
  • msysGit 安装程序具有前缀 msysGit-。

另一个说明是 msysGit 安装程序有两种形式:fullinstall 和 netinstall。
此外,C:\Program Files默认情况下不会安装 msysGit 。
但是 msysGit 带有gccGNU C 编译器。

c/ From MSysGitHerald10:

c/ 来自MSysGitHerald10

Remember:

  • MinGW is really a very thin compile-time layer over the Microsoft Runtime; MinGW programs are therefore real Windows programs, with no concept of Unix-style paths or POSIX niceties such as a fork()call.
  • MSys, in contrast, is a slimmed-down version of Cygwin (an old version at that), whose only purpose is to provide enough of a POSIX layer to run a bash.

记住:

  • MinGW 确实是 Microsoft Runtime 之上的一个非常薄的编译时层;因此,MinGW 程序是真正的 Windows 程序,没有 Unix 风格的路径或 POSIX 细节(如fork()调用)的概念。
  • 相比之下,MSys 是 Cygwin 的精简版(旧版本),其唯一目的是提供足够的 POSIX 层来运行 bash。

And that is not always welcomed:

并不总是受欢迎的

When working on Windows, I dislike that msysGit, as the name suggests, depends on MSYS and on tools from the Unix world. I believe all programs in the Git distribution should become binaries compiled for a specific platform, and not rely on shell interpreters or third-party languages like Tcl/Tk.

在 Windows 上工作时,我不喜欢 msysGit,顾名思义,它依赖于 MSYS 和来自 Unix 世界的工具。我相信 Git 发行版中的所有程序都应该成为针对特定平台编译的二进制文件,而不是依赖于 shell 解释器或第三方语言,如 Tcl/Tk。

Even though, it is far better than the first Git on Cygwininstallations from 2007.

尽管如此,它还是比2007 年在 Cygwin 上安装的第一个Git好得多。

回答by bwawok

cygwin + git was the only way to make git work back in the day. Now that msysgit is around, I don't see any reason to use cygwin.

cygwin + git 是让 git 恢复工作的唯一方法。现在 msysgit 已经存在,我看不出有任何理由使用 cygwin。

I agree git bash isn't that good.. so what I do is

我同意 git bash 不是那么好..所以我做的是

  1. Put git in path and use window command prompt when I need command line
  2. Have tortoise git installed for when I want to have a GUI to my git
  1. 将 git 放在路径中并在需要命令行时使用窗口命令提示符
  2. 当我想要我的 git 有一个 GUI 时,安装了 tortoise git

回答by Peter - Reinstate Monica

This is an answer from 2017...

这是2017年的回答...

The fundamental technical difference is that all cygwin programs depend on the cygwin1.dll; but that's at the same time the least interesting one for the end user since it should be almost completely transparent. The main differences I found are not between the git versions as much as between the cygwin environment and msys/mingw environment. These are some differences I found:

根本的技术区别在于所有 cygwin 程序都依赖于 cygwin1.dll;但这同时也是最终用户最不感兴趣的一个,因为它应该几乎完全透明。我发现的主要区别不在于 git 版本之间,而在于 cygwin 环境和 msys/mingw 环境之间。这些是我发现的一些差异:

  • ACL handling. The way newer (post-2015) cygwins handles NTFS access control lists can be annoying to the point of dangerous. By default, the Windows drives are mounted with the acl option active. Cygwin tries to mimic POSIX permissions by re-shuffling and abusing ACL entries in a way which can make access through native windows programs impossible. Additionally it's possible that file access is slowed down dramatically in multi-user multi-domain (i.e., commercial or institutional) installations due to network access, because determining user and permissions potentially requires domain server queries for each file.

    msys mounts with the -noacloption by default. Doing that in cygwin as well seems to avoid those issues.
  • Speed. I'm currently working in a repository with 100k files (don't ask). A git statuswith all relevant disk contents in the cache takes 4.7 seconds with cygwin and 0.4 seconds with msys git. I'm not sure which part of the cygwin compatibility layer is slowing things down -- locks, forks, filesystem, IPC... they all are candidates.
  • Potentially filenames. I have not investigated the issue but I would suspect that a git (and the other tools) targeted for windows (like msys git) can handle windows file names better. Under cygwin one must diligently convert file names via cygpathbetween the two worlds. That will play an important role when scripts etc. interface with Windows programs.
  • ACL 处理。较新的(2015 年后)cygwins 处理 NTFS 访问控制列表的方式可能会令人讨厌到危险的地步。默认情况下,Windows 驱动器在 acl 选项处于活动状态的情况下安装。Cygwin 试图通过重新改组和滥用 ACL 条目来模拟 POSIX 权限,这种方式可以使通过本机 Windows 程序进行访问变得不可能。此外,由于网络访问,文件访问在多用户多域(即商业或机构)安装中可能会显着减慢,因为确定用户和权限可能需要对每个文件进行域服务器查询。默认情况下,

    msys 使用该-noacl选项挂载。在 cygwin 中这样做似乎也避免了这些问题。
  • 速度。我目前正在一个包含 10 万个文件的存储库中工作(不要问)。git status缓存中所有相关磁盘内容的A使用 cygwin 需要 4.7 秒,使用 msys git 需要 0.4 秒。我不确定 cygwin 兼容层的哪一部分会减慢速度——锁、分叉、文件系统、IPC……它们都是候选对象。
  • 可能是文件名。我还没有调查过这个问题,但我怀疑针对 windows(如 msys git)的 g​​it(和其他工具)可以更好地处理 windows 文件名。在 cygwin 下,必须努力cygpath在两个世界之间转换文件名。当脚本等与 Windows 程序交互时,这将发挥重要作用。

Edit: it is perhaps not obvious that with some minor tweaks it is possible to share common settings for git (but not only for git) between cygwin and Msys2. If I remember correctly a good way is to set the HOME environment variable in the Windows system settings; then both Msys2 and cygwin will use that directory and hence the same dot-files, among them ~/.gitignore. That makes changing between cygwin and Msys2 terminals pretty painless (think ~/.inputrc, ~/.bashrc, ~/.profile...).

编辑:通过一些小的调整,可以在 cygwin 和 Msys2 之间共享 git(但不仅是 git)的通用设置可能并不明显。如果我没记错的话,一个好方法是在 Windows 系统设置中设置 HOME 环境变量;那么 Msys2 和 cygwin 都将使用该目录,因此使用相同的点文件,其中包括~/.gitignore. 这使Cygwin和Msys2终端相当痛苦之间变化(认为~/.inputrc~/.bashrc~/.profile...)。

回答by cmcginty

MSysGit ships with a very old version of SSH. Throughput on my system was around 10 mbit. If you don't care about clone speeds, then this does not affect you. The fix is to either run Cygwin Git or replace the SSH installed in MSysGit.

MSysGit 附带一个非常旧版本的 SSH。我的系统的吞吐量约为 10 兆位。如果您不关心克隆速度,那么这不会影响您。修复方法是运行 Cygwin Git 或替换安装在 MSysGit 中的 SSH

回答by Adam Dymitruk

The bash implementation in msysgit is old. However, i use vim when editing and that works great. As for cutting and pasting, I often resort to SHIFT+ALT+[space], E, M or whatever the keys are to get to mark text I want. Not ideal, but does the job well enough as I don't cut and paste too much.

msysgit 中的 bash 实现是旧的。但是,我在编辑时使用 vim,效果很好。至于剪切和粘贴,我经常使用 SHIFT+ALT+[空格]、E、M 或任何键来标记我想要的文本。不理想,但做得足够好,因为我不会剪切和粘贴太多。

I've now started running Ubuntu on the same machine through VirtualBox. With seamless mode and shared folders, I can take advantage of an up to date bash and fast Git.

我现在已经开始通过 VirtualBox 在同一台机器上运行 Ubuntu。通过无缝模式和共享文件夹,我可以利用最新的 bash 和快速 Git。

I do not use any gui tools for Git except gitk (for gitk --all) to visualize history if I need to.

如果需要,除了 gitk(用于 gitk --all)之外,我不使用 Git 的任何 gui 工具来可视化历史。

I've tried cygwin and didn't like it. The virtual box solution is much better if msysgit is not enough for you.

我试过 cygwin 但不喜欢它。如果 msysgit 对您来说还不够,虚拟盒解决方案会好得多。

回答by Theoxylo

The current version of git on cygwin is 1.7.5.1, which is very, very current (May, 2011).

cygwin 上的当前 git 版本是 1.7.5.1,非常非常新(2011 年 5 月)。

I see no reason (so far) to use anything else, though I am considering giving msysgit (aka "Git for Windows") a try (currently version 1.7.4).

我认为没有理由(到目前为止)使用其他任何东西,尽管我正在考虑尝试使用 msysgit(又名“Git for Windows”)(当前版本为 1.7.4)。

回答by locka

Msysgit has received a number of patches to deal with Windows specific issues such as filesystem case insensitivity, file locking etc. It's probably a bad idea to use the cygwin version. If you have cygwin on your system I'd advise not installing git at all, and preferably not sharing msysgit or cygwin environments from the same PATH.

Msysgit 已收到许多补丁来处理 Windows 特定问题,例如文件系统不区分大小写、文件锁定等。使用 cygwin 版本可能是一个坏主意。如果您的系统上有 cygwin,我建议您根本不要安装 git,最好不要从同一 PATH 共享 msysgit 或 cygwin 环境。

回答by intotecho

cygwin sees your local files in windows format, whereas git-bash sees them in unix format. If you check out files in git-bash then run git status on a cygwin shell, git thinks you have modified every line in the repo, if you run git status in the git-bash shell, then only files you have touched are modified.

cygwin 以 windows 格式查看本地文件,而 git-bash 以 unix 格式查看它们。如果你在 git-bash 中检出文件,然后在 cygwin shell 上运行 git status,git 认为你已经修改了 repo 中的每一行,如果你在 git-bash shell 中运行 git status,那么只有你接触过的文件被修改。

回答by weberjn

This is an answer from 2018...

这是2018年的回答...

Git for Windowsis based on MSYS2.

Windows 版 Git基于MSYS2

MSYS2 was started with the idea to restart the MSys project, frequently updating with Cygwin and just keeping the spirit of MSys to provide a very stripped-down POSIX layer, essentially a bare-minimum version of Cygwin. MSYS2 also sports a package manager (pacman) and keeps those packages up-to-date very well.

MSYS2 开始时的想法是重新启动 MSys 项目,经常使用 Cygwin 进行更新,并保持 MSys 的精神以提供非常精简的 POSIX 层,本质上是 Cygwin 的最低版本。MSYS2 还运行了一个包管理器 (pacman),并且可以很好地保持这些包的最新状态。

..

..

MSYS2's runtime is a stripped-down, slightly modified Cygwin runtime running on top of the Windows kernel, while Linux' runtime is the Linux kernel, running as a separate OS altogether.

MSYS2 的运行时是运行在 Windows 内核之上的精简的、稍微修改过的 Cygwin 运行时,而 Linux 的运行时是 Linux 内核,完全作为单独的操作系统运行。

https://github.com/git-for-windows/git/wiki

https://github.com/git-for-windows/git/wiki

Cygwin provides a runtime library called cygwin1.dll that provides the POSIX compatibility layer where necessary. The MSYS2 variant of this library is called msys-2.0.dll and includes the following changes to support using native Windows programs: How does MSYS2 differ from Cygwin

Cygwin 提供了一个名为 cygwin1.dll 的运行时库,它在必要时提供 POSIX 兼容层。此库的 MSYS2 变体称为 msys-2.0.dll,包括以下更改以支持使用本机 Windows 程序:MSYS2 与 Cygwin 有何不同

Dependency Walker Git Bash

依赖 Walker Git Bash

回答by Keith Tyler

If you plan on doing more than just git commands in git bash, I'd suggest Cygwin with git.

如果您打算在 git bash 中执行的不仅仅是 git 命令,我建议使用 git 使用 Cygwin。

If you plan on not doing anything but git commands in git bash, then a) sure, use git bash, but b) why not just use Git GUI?

如果你打算在 git bash 中除了 git 命令之外什么都不做,那么 a) 当然,使用 git bash,但是 b) 为什么不只使用 Git GUI?

Git bash is not that bad, BUT, there's times when I need to use Cygwin for things that simply don't work in git bash. (Perl CPAN, for example. XSL tools, for another.) Which seems really silly to have to use two totally different bash command line implementations.

Git bash 并没有那么糟糕,但是,有时我需要使用 Cygwin 来处理在 git bash 中根本不起作用的事情。(例如,Perl CPAN。另一个是 XSL 工具。)不得不使用两个完全不同的 bash 命令行实现似乎真的很愚蠢。