[英]Git recommendations, cygwin, WSL, PowerShell posh-git Module
I'm quite new to using git, so I'm not very knowledgeable, but have some questions, specifically about using git on Windows.我对使用 git 很陌生,所以我不是很了解,但有一些问题,特别是关于在 Windows 上使用 git。
posh-git
PowerShell Module.posh-git
PowerShell 模块。 Can the Cmdlets / Functions in here do everything that git do and so make downloading and installing git?cinst -y git
installs also the cygwin.cinst -y git
安装 cygwin。 I have a problem with cygwin in that it's somewhat redundant these days, especially with things like WSL.git.exe
right?).git.exe
对吗?)。 I used to love cygwin and use it all the time, but in 2020, it does seem somewhat redundant, right?sudo apt install git
and then go back into Windows and just create a PowerShell function (using the wsl
method to gain access to a command in the default WSL installation from Windows)? sudo apt install git
and then go back into Windows and just create a PowerShell function (using the wsl
method to gain access to a command in the default WSL installation from Windows)? I think something like this should work: function git { wsl git }
Advice from experts on which of the above would be most efficient and sensible would be appreciated.我们将不胜感激专家就上述哪种方法最有效和最明智的建议。
If you want a native Windows version of Git, the recommended option is Git for Windows, which you can download from that link or with Chocolatey.如果您想要 Git 的原生 Windows 版本,推荐的选项是 Git 用于 ZAEA23489CE3AA9B43406EBB2,您可以从该链接下载。 Because Git is designed for Unix, you do need a POSIX shell and a POSIX environment, which is shipped with Git for Windows.
Because Git is designed for Unix, you do need a POSIX shell and a POSIX environment, which is shipped with Git for Windows. This is based off of MINGW, not Cygwin, but it is required so that programs written in shell, as well as things that invoke the shell like your editor, work.
这是基于 MINGW,而不是 Cygwin,但它是必需的,以便用 shell 编写的程序以及像您的编辑器一样调用 shell 的东西工作。 posh-git doesn't change that.
posh-git 不会改变这一点。
You can indeed use Git from WSL, but I would not recommend using it from a non-sh environment such as PowerShell.您确实可以使用 WSL 中的 Git,但我不建议在非 sh 环境中使用它,例如 PowerShell。 That's because a Unix Git will expect paths and such to be in the Unix format and won't accept any sort of Windows paths at all.
这是因为 Unix Git 将期望路径等采用 Unix 格式,并且不会在所有路径中接受任何类型的 ZAEA23489CE3AAB94636。 So you can use WSL Git, but I strongly recommend using it from WSL and not PowerShell.
所以你可以使用 WSL Git,但我强烈建议从 WSL 使用它,而不是 PowerShell。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.