msysgit 和 Cygwin 之间的区别 +吉特?

发布于 2024-09-08 06:03:50 字数 192 浏览 4 评论 0 原文

msysgit 和 Cygwin + git 有什么区别?

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

What is the difference between msysgit and 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

唐婉 2024-09-15 06:03:51

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

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

  1. 将 git 放入路径中并在需要命令行时使用窗口命令提示符当我
  2. 想要为我的 git 提供 GUI 时安装 tortoise git

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.

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

  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
み零 2024-09-15 06:03:51

这是2017年的答案...

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

  • ACL 处理。较新的(2015 年后)cygwins 处理 NTFS 访问控制列表的方式可能会令人烦恼甚至危险。默认情况下,Windows 驱动器在 acl 选项处于活动状态时挂载。 Cygwin 试图通过重新洗牌和滥用 ACL 条目来模仿 POSIX 权限,这种方式可能使通过本机 Windows 程序进行访问变得不可能。此外,由于网络访问,在多用户多域(即商业或机构)安装中文件访问可能会显着减慢,因为确定用户和权限可能需要对每个文件进行域服务器查询。

    msys 默认使用 -noacl 选项挂载。在 cygwin 中这样做似乎也可以避免这些问题。

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

编辑:也许不明显的是,通过一些小的调整,可以在 cygwin 和 Msys2 之间共享 git(但不仅限于 git)的通用设置。如果我没记错的话,一个好方法是在 Windows 系统设置中设置 HOME 环境变量;那么 Msys2 和 cygwin 都将使用该目录,因此使用相同的点文件,其中 ~/.gitignore。这使得 cygwin 和 Msys2 终端之间的更改变得非常轻松(想想 ~/.inputrc~/.bashrc~/.profile... )。

This is an answer from 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:

  • 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 -noacl option 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 status with 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 cygpath between the two worlds. That will play an important role when scripts etc. interface with Windows programs.

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...).

℡Ms空城旧梦 2024-09-15 06:03:51

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

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.

半步萧音过轻尘 2024-09-15 06:03:51

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

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

如果需要的话,我不会使用任何 Git 的 gui 工具,除了 gitk (for gitk --all) 来可视化历史记录。

我尝试过 cygwin 但不喜欢它。如果 msysgit 不足以满足您的需求,则虚拟盒解决方案会更好。

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.

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.

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

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

萌能量女王 2024-09-15 06:03:51

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

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

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

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).

溺孤伤于心 2024-09-15 06:03:51

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

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.

痴意少年 2024-09-15 06:03:51

cygwin 以 Windows 格式查看本地文件,而 git-bash 以 unix 格式查看它们。如果您在 git-bash 中签出文件,然后在 cygwin shell 上运行 git status,git 会认为您已经修改了存储库中的每一行,如果您在 git-bash shell 中运行 git status,则只有您触及的文件会被修改。

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.

罗罗贝儿 2024-09-15 06:03:51

这是 2018 年的答案...

Git for Windows 基于 MSYS2

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

..

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

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

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

< img src="https://i.sstatic.net/ezHfq.png" alt="Dependency Walker Git Bash">

This is an answer from 2018...

Git for Windows is based on 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'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.

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

Dependency Walker Git Bash

翻身的咸鱼 2024-09-15 06:03:51

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

如果您打算在 git bash 中除了 git 命令之外不执行任何操作,那么 a) 当然,使用 git bash,但是 b) 为什么不只使用 Git GUI?

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

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

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 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.

白龙吟 2024-09-15 06:03:50

2018 年编辑:

自我 2010-2012-2014 年回答以来,2015 年 Windows 版 Git 使用 msys2,正如我详细信息

请参阅“msys、msys2 和 msysgit 彼此之间有何关系?”了解更多信息。


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

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

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

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

  • 致力于 Git for Windows(使用 < a href="https://github.com/git-for-windows" rel="nofollow noreferrer">对应的 GitHub 组织),
  • 使用名称“Git for Windows”作为针对“最终用户”的安装程序,并且
  • 使用名称“Git for Windows SDK”来表示面向 Windows 开发人员的 Git 开发环境。

两年后更新:2012 年 7 月

Msysgit 将继续存在,除非您需要为 cygwin 添加几百 MB,您真的不需要 Cygwin 就可以在 Windows 上使用 Git。
如果您想访问 GitHub,您将获得一个带有 Windows 版 GitHub

Gitmsysgit 位于 GitHub 上。
msysgit.github.com 页面清楚地说明了以下之间的区别:

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

另请参阅msysgit 常见问题解答

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

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

因此,我们为 Windows 提供了 Git,并附带了 MSys 的最小版本。

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

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


原始答案:2010 年 6 月

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

b/ 您可能使用的是“Git for windows”,而不是 msysgit。来自 wiki

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

很容易看出差异:

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

另一个迹象是 msysGit 安装程序有两种风格:fullinstall 和 netinstall。
此外,msysGit 默认情况下不会安装到 C:\Program Files
但 msysGit 附带了 GNU C 编译器 gcc。

c/ 来自 MSysGitHerald10

记住:

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

并不总是受欢迎

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

尽管如此,它还是比第一个 Git on Cygwin 从 2007 年开始安装。

Edit 2018:

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

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


Edit (2 more years later: October 2014)

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

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).

Update 2 years later: July 2012

Msysgit is here to stay, and unless you need to 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.

Both Git and msysgit are on GitHub.
The msysgit.github.com page clearly illustrates the difference between:

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

See also the msysgit FAQ:

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 MinGW program, 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.


Original answer: June 2010

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

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

  • 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 Files by default.
But msysGit comes with gcc, the GNU C Compiler.

c/ From 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.

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.

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文