简体   繁体   English

升级到Windows 10后,Git-Bash命令提示符将无法打开

[英]Git-Bash Command Prompt won't open up after upgrading to Windows 10

I just upgraded my OS to Windows 10 and Git Bash won't even open up anymore. 我刚刚将操作系统升级到Windows 10,Git Bash甚至不再打开。 I might need to uninstall and re-install it again but I was just wondering if anyone else ran into this problem after upgrading to Windows 10 and what their fix was other than un-installing and re-installing ? 我可能需要再次卸载并重新安装它,但我只是想知道升级到Windows 10之后是否有其他人遇到此问题以及除了卸载和重新安装之外他们的修复是什么?

I have to face the same problem when upgraded my windows from 7 to 10. I tried by reinstalling the git bash but re installation not works for me.it is due to the permission issue with the shell script parser sh.exe file. 我将Windows从7升级到10时必须面对同样的问题。我尝试重新安装git bash但重新安装不适用于我。这是由于shell脚本解析器sh.exe文件的权限问题。 all you need to do is use bash as your shell script parser instead of sh. 您需要做的就是使用bash作为shell脚本解析器而不是sh。

you can do that as below. 你可以这样做,如下所示。

Step 1: 步骤1:

Resolve the issue with the shortcut 使用快捷方式解决问题

  • right click and open properties dialog of the Git Bash short cut located in your desktop or in your start menu (C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Git\\Git Bash.lnk in my PC), you will see the below Target in the "Short cut" tab. 右键单击并打开位于桌面或开始菜单中的Git Bash快捷方式的对话框(C:\\ ProgramData \\ Microsoft \\ Windows \\ Start Menu \\ Programs \\ Git \\ Git Bash.lnk在我的电脑中),你会看到“快捷方式”选项卡中的以下目标。

    "C:\\Program Files\\Git\\bin\\sh.exe" --login -i" “C:\\ Program Files \\ Git \\ bin \\ sh.exe”--login -i“

    just replace sh.exe to bash.exe as below 只需将sh.exe替换为bash.exe,如下所示

    "C:\\Program Files\\Git\\bin\\bash.exe" --login -i" “C:\\ Program Files \\ Git \\ bin \\ bash.exe”--login -i“

Step 2 : 第2步 :

  • Resolve the problems with the sh commands. 使用sh命令解决问题。

    Go to the Git Bash bin folder (C:\\Program Files\\Git\\bin in my PC) 转到Git Bash bin文件夹(我的PC中的C:\\ Program Files \\ Git \\ bin)

    Take a backup : copy the sh.exe file into old-sh.exe and delete the sh.exe file 进行备份:将sh.exe文件复制到old-sh.exe并删除sh.exe文件

    open the git bash and execute below commands. 打开git bash并执行以下命令。

    • cd /bin cd / bin
    • ln /bin/bash.exe sh ln /bin/bash.exe sh

it worked for me. 它对我有用。 don't know the same will workout for you. 不知道同样会为你锻炼。

There have been few instances where other users who have upgraded to windows 10 are facing similar issues with respect to Git Bash and git in general. 很少有其他升级到Windows 10的用户面临与Git Bash和git相关的类似问题。 An issue has been opened with msysgit on GitHub. 在GitHub上使用msysgit打开了一个问题。 Official clarification will be posted on that page very soon. 官方澄清将很快发布在该页面上。

A similar issue but not related to Git Bash particularly on Windows 10 platform is being resolved here. 类似的问题,但与Git Bash无关,特别是在Windows 10平台上, 这里正在解决

If your issue is not very serious, it is advisable to uninstall and install an appropriate version of Git Bash for Windows 10. 如果您的问题不是很严重,建议卸载并安装适用于Windows 10的Git Bash版本。

I had issues with git bash on windows 10 as well. 我在Windows 10上也遇到了git bash的问题。 Git bash was not even opening on windows 10 ( the window was getting closed soon after the launch ). Git bash甚至没有在Windows 10上打开(窗口在发布后很快关闭)。

To solve the problem all I had to do was to: 要解决这个问题,我所要做的就是:

  1. Right click on the git bash icon 右键单击git bash图标
  2. Run as administrator. 以管理员身份运行。

The problem disappeared. 问题消失了。

This issue has been so damn frustrating... and the only reason I'm going through it is because the company I'm contracting for issued me a DELL laptop with a fresh install of Windows 10. 这个问题真是令人沮丧......而且我经历这个问题的唯一原因是因为我正在签约的公司给我发了一台全新安装Windows 10的戴尔笔记本电脑。

So after all the frustration of trying this and that, it finally hit me... VSCode has an integrated terminal! 所以在尝试了这个和那之后的所有挫折之后,它终于打动了我...... VSCode有一个集成的终端! The shell defaults to powershell.exe on startup of VSCode but you can change that in your user settings (settings.json). 在启动VSCode时,shell默认为powershell.exe ,但您可以在用户设置(settings.json)中更改它。

The "Default User Settings" look like this: “默认用户设置”如下所示:

{
  // The path of the shell that the terminal uses on Windows.
  "terminal.integrated.shell.windows": 
  "C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
}

Change your "User Settings" look like this: 更改 “用户设置”是这样的:

{
  // The path of the shell that the terminal uses on Windows.
  "terminal.integrated.shell.windows": 
  "C:\\Users\\<UserName>\\AppData\\Local\\Programs\\Git\\bin\\bash.exe"
}

This works great for me and if you're having the same issue, I hope it works for you... 这对我很有用,如果你遇到同样的问题,我希望它对你有用......

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

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