在 Windows 10 命令行中启用 git
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35619305/
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
Enabling git in Windows 10 command line
提问by Vendea
I cannot seem to make git work from my native Windows command line.
I have tried PowerShell, I have the path to the git bin in my Environment Variables, but it is still giving me a "command not found
" when I type git
. I have looked at the solutions
here, and none of them work for me.
I don't have a C:/Program Files/git folder (or Program Files(x86))
.
我似乎无法从我的本机 Windows 命令行使 git 工作。
我试过 PowerShell,我的环境变量中有 git bin 的路径,但是command not found
当我输入git
. 我看过这里的解决方案
,但没有一个对我有用。
我没有C:/Program Files/git folder (or Program Files(x86))
。
I can make command line git work if I open up the git desktop app and then use the "open a terminal with git enabled" option from there.
如果我打开 git 桌面应用程序,然后从那里使用“打开启用 git 的终端”选项,我可以使命令行 git 工作。
That is all well and good, except that opening the desktop app takes forever on my laptop, and I would prefer to be able to just whip out the command line to pull my code.
这一切都很好,只是在我的笔记本电脑上打开桌面应用程序需要很长时间,我更希望能够直接打开命令行来提取我的代码。
I am open to reinstalling git and following specific instructions, or installing a more workable version of git, if anyone has suggestions. Thank you.
如果有人有建议,我愿意重新安装 git 并遵循特定说明,或者安装更可行的 git 版本。谢谢你。
回答by VonC
Simply uncompress the latest git for windows releaseportable archive (like PortableGit-2.7.2-64-bit.7z.exe) anywhere you want and add to your PATH:
只需将最新的git for windows 发布可移植存档(如PortableGit-2.7.2-64-bit.7z.exe)解压到任何您想要的位置并添加到您的路径中:
c:\path\to\git;c:\path\to\git\bin;c:\path\to\git\usr\bin;c:\path\to\git\mingw64\bin
You will get git-bash.exe
(recent 4.3+ bash based on msys2), but also 200+ unix commands right in your regular CMD shell.
您将在常规 CMD shell 中获得git-bash.exe
(基于 msys2 的最新4.3+bash ),以及 200 多个 unix 命令。