git 如何在 msysGit 中使用 Zsh
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16851991/
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
How to use Zsh with msysGit
提问by Micha Wiedenmann
msysGit comes with an Explorer shell extension showing Git Bash Here
in the context menu of a folder which opens a Bash prompt in the selected folder.
msysGit 带有一个资源管理器外壳扩展,显示Git Bash Here
在文件夹的上下文菜单中,在所选文件夹中打开 Bash 提示。
How can I use Zsh instead of Bash as the shell for this command window?
如何使用 Zsh 而不是 Bash 作为此命令窗口的 shell?
回答by tpatja
The built-in Bash that msysGit provides is built on top of conhost.exe
. That makes it terrible compared to, e.g., xterm (clipboard, text input/output, history, etc.).
msysGit 提供的内置 Bash 建立在conhost.exe
. 与例如 xterm(剪贴板、文本输入/输出、历史记录等)相比,这使它变得很糟糕。
The workaround I'm currently using when on Windows is I use the latest msysGit + Cygwin mintty with Bash. That gives me a decent shell with a recent and fast Git. With that approach you can use other shells, like Zsh. Beware that the tradeoffs include Git not being able to use your PAGER (I had to alias things like git log
to git log|less
).
我目前在 Windows 上使用的解决方法是使用最新的 msysGit + Cygwin mintty 和 Bash。这给了我一个像样的外壳和一个最近的快速 Git。通过这种方法,您可以使用其他 shell,例如 Zsh。请注意,权衡包括 Git 无法使用您的 PAGER(我不得不为诸如git log
to 之类的东西添加别名git log|less
)。
回答by Melebius
Babunis a variant that is easy to set up. It is based on Cygwin, provides Zsh (including Oh My Zsh) and Git ready to use out of the box.
Babun是一种易于设置的变体。它基于 Cygwin,提供开箱即用的Zsh(包括Oh My Zsh)和 Git。
Technically, it is not using Zsh with msysGitsince Babun includes its own version of Git. Furthermore, Babun takes about twice the space needed by msysGit (including Git Bash). However, it may become a viable alternative thanks to the easy setup and further usage possibilities in comparison to msysGit.
从技术上讲,它没有将 Zsh 与msysGit一起使用,因为 Babun 包含自己的 Git 版本。此外,Babun 占用的空间大约是 msysGit(包括 Git Bash)所需空间的两倍。但是,与 msysGit 相比,由于易于设置和进一步使用的可能性,它可能成为一个可行的替代方案。
Update:Babun project is discontinued. On Windows 10, you can use WSLinstead and install all requested software (like Git and Zsh) using the package manager of the chosen Linux distro.
更新:Babun 项目已停止。在 Windows 10 上,您可以改用WSL,并使用所选 Linux 发行版的包管理器安装所有请求的软件(如 Git 和 Zsh)。
回答by Florian Breisch
MsysGit does not support other shells than the built-in Bash.
MsysGit 不支持内置 Bash 之外的其他 shell。
You may consider using Cygwin- if you can't live without Zsh (i understand you) - which also provides a git-package.
你可以考虑使用Cygwin——如果你不能没有 Zsh(我理解你)——它也提供了一个git-package。
Unfortunately this package is pretty old (v1.7.9 is from Jan '12) which may cause problems in the interaction with newer repositories.
不幸的是,这个包很旧(v1.7.9 来自 12 年 1 月),这可能会导致与较新的存储库交互时出现问题。
回答by xsilen T
you should install pacman first. you can install msys then copy following files to git for windows install dir.
你应该先安装pacman。您可以安装 msys,然后将以下文件复制到 git for windows 安装目录。
./etc/pacman.conf
./etc/pacman.d/gnupg/.gpg-v21-migrated
./etc/pacman.d/gnupg/crls.d/DIR.txt
./etc/pacman.d/gnupg/gpg-agent.conf
./etc/pacman.d/gnupg/gpg.conf
./etc/pacman.d/gnupg/openpgp-revocs.d/95B7E06B8C47127F398481080BDA45A606729940.rev
./etc/pacman.d/gnupg/private-keys-v1.d/1124CC687F416E4D7C43EB618BECDD023E787046.key
./etc/pacman.d/gnupg/pubring.gpg
./etc/pacman.d/gnupg/pubring.gpg~
./etc/pacman.d/gnupg/secring.gpg
./etc/pacman.d/gnupg/tofu.db
./etc/pacman.d/gnupg/trustdb.gpg
./etc/pacman.d/mirrorlist.mingw32
./etc/pacman.d/mirrorlist.mingw64
./etc/pacman.d/mirrorlist.msys
./usr/bin/pacboy
./usr/bin/paccache
./usr/bin/pacdiff
./usr/bin/paclist
./usr/bin/paclog-pkglist
./usr/bin/pacman-conf.exe
./usr/bin/pacman-db-upgrade
./usr/bin/pacman-key
./usr/bin/pacman-rec-filename-grep
./usr/bin/pacman.exe
./usr/bin/pacscripts
./usr/bin/pacsearch
./usr/bin/pacsort.exe
./usr/bin/pactoys
I just copy all binary start with pac
from /usr/bin/ dir.
now you have a pacman. install zsh use pacman -S zsh
command.
我只是pac
从 /usr/bin/dir复制所有二进制文件开始。现在你有一个吃豆子了。安装 zsh 使用pacman -S zsh
命令。
see tutorial from https://medium.com/@borekb/zsh-via-msys2-on-windows-3964a943b1ce
请参阅https://medium.com/@borekb/zsh-via-msys2-on-windows-3964a943b1ce 中的教程