简体   繁体   English

在Windows 10命令行中启用git

[英]Enabling git in Windows 10 command line

I cannot seem to make git work from my native Windows command line. 我似乎无法从我的本机Windows命令行中使用git。
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 . 我尝试过PowerShell,我在环境变量中有git bin的路径,但是当我输入git时它仍然给我一个“ command not found ”。 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)) . 我没有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. 我愿意重新安装git并遵循特定说明,或安装更可行的git版本,如果有人有建议的话。 Thank you. 谢谢。

Simply uncompress the latest git for windows release portable 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 )并添加到PATH中:

 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. 您将获得git-bash.exe基于 git-bash.exe最新4.3 + bash),以及常规CMD shell中的200多个unix命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM