Git Bash 在 Windows 10 PC 上立即关闭
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34378316/
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
Git Bash Closes Immediately on Windows 10 PC
提问by Sarah Bartley
On Tuesday, my Git Bash app on my computer started to close when I would open the app on my PC.
周二,当我打开 PC 上的应用程序时,我计算机上的 Git Bash 应用程序开始关闭。
When I open the app, the cursor will blink for a couple of seconds then close Git Bash automatically. This is what I see right before Git Bash closesI uninstalled Git and reinstalled it, but Git Bash still closes after a few seconds.
当我打开应用程序时,光标会闪烁几秒钟,然后自动关闭 Git Bash。这是我在 Git Bash 关闭之前看到的我卸载了 Git 并重新安装了它,但 Git Bash 在几秒钟后仍然关闭。
I double checked my environment variables to make sure what I had set for the PATH and double checked my version of Git Bash.
我仔细检查了我的环境变量以确保我为 PATH 设置了什么,并仔细检查了我的 Git Bash 版本。
Right now my PATH in System Variables is set to C:\Path\To\Git\2.1.7\bin;C:\Program Files\Git\cmd.
I am taking coding classes online and one of my teachers suggested I look at the Git-Bash Command Prompt won't open after upgrading to Windows 10 articleto see if I was able to get it to work.
现在我在系统变量中的 PATH 设置为 C:\Path\To\Git\2.1.7\bin;C:\Program Files\Git\cmd。
我正在参加在线编程课程,我的一位老师建议我查看升级到 Windows 10 后无法打开 Git-Bash 命令提示符的文章,看看我是否能够让它工作。
I tried both of the suggestions given in the article, however Git Bash won't stay open.
我尝试了文章中给出的两个建议,但是 Git Bash 不会保持打开状态。
Should I reset my PATH for systems variables? I have a PC with Windows 10 and Git Bash was working just fine with the latest version until now. Are there any ways I can check for bugs in Git Bash?
我应该为系统变量重置我的 PATH 吗?我有一台装有 Windows 10 的 PC,到目前为止,Git Bash 在最新版本上运行良好。有什么方法可以检查 Git Bash 中的错误吗?
采纳答案by VonC
git bash was considerably improved since 2.1.7.
git bash 从 2.1.7 开始有了很大的改进。
Uncompress PortableGit-2.6.4-64-bit.7z.exe
in c:\prgs\git, and add to your PATH (removing first any git occurrences)
PortableGit-2.6.4-64-bit.7z.exe
在 c:\prgs\git 中解压缩,并添加到您的 PATH(首先删除任何 git 出现)
c:\prgs\git
c:\prgs\git\bin
c:\prgs\git\usr\bin
Then open a cmd, and see if git-bash
is working.
然后打开一个cmd,看看是否git-bash
有效。
回答by xmlnsBuzz
I solve this problem to make folder named 'etc' in
我解决了这个问题,使文件夹名为“etc”
'C:\Windows\System32\drivers' folder.
'C:\Windows\System32\drivers' 文件夹。
As s result the path will be
结果路径将是
'C:\Windows\System32\drivers\etc'
'C:\Windows\System32\drivers\etc'
Right click to open git bash on window explorer. Close bash window and reopen.
右键单击以在窗口资源管理器上打开 git bash。关闭 bash 窗口并重新打开。
If you ask me this solving applies to everybody? I don't know. I updated latest version of git 2.19 yesterday and the same problem above occurred. I'm worry about you misunderstand my words. Because I'm not good at English.
如果你问我这个解决方法适用于所有人吗?我不知道。我昨天更新了最新版本的 git 2.19 并且发生了上述同样的问题。我担心你误会我的话。因为我英语不好。
回答by Adi's
Just try the command bash -c sh
in cmd, does that work? If so then either you will see a link from where you need to install ubuntu of other linux flavours if not then you need to install the ubuntu or any other linux flavour from microsoft store of your windows. After installing it then you can launch it after installation and do rest of the work you need to do in linux bash.
试试bash -c sh
cmd里的命令,行不行?如果是这样,那么您将看到一个链接,从那里您需要安装其他 linux 风格的 ubuntu 如果没有,那么您需要安装 ubuntu 或来自 Windows 微软商店的任何其他 linux 风格。安装后,您可以在安装后启动它,并在 linux bash 中完成您需要完成的其余工作。
回答by Khaled Elsherbiny
It is because Windows Subsystem for Linux has no installed distributions on your PC/Laptop.
这是因为适用于 Linux 的 Windows 子系统没有在您的 PC/笔记本电脑上安装发行版。
Distributions can be installed by visiting the Microsoft Store or via this linkand you can choose the Linux distribution you want.
可以通过访问 Microsoft Store 或通过此链接安装发行版,您可以选择所需的 Linux 发行版。
After that, you will simply be able to open your bash window normally.
之后,您就可以正常打开 bash 窗口了。