如何在 Windows Git shell 中运行 ./script.sh?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16772202/
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
How to run ./script.sh in windows Git shell?
提问by Szorstki
Maybe it's awkward, but I can't run .sh file on Windows when working in Git shell. Probably I have to install something, but I thought that Git will support that bash command (I know Windows don't use sh files).
也许这很尴尬,但在 Git shell 中工作时,我无法在 Windows 上运行 .sh 文件。可能我必须安装一些东西,但我认为 Git 会支持那个 bash 命令(我知道 Windows 不使用 sh 文件)。
I am doing installation steps from GameClosureand after $ ./install.sh
a window with application selection to open sh file appears (like that when you try to open unknown file in Windows, it asks what application to open this you would like to use).
I've tried open it with Git shell, but failed... What I have to do to run this fileand proceed with installation steps from GameClosure tutorial?**
我正在从GameClosure执行安装步骤,并且在出现$ ./install.sh
一个带有应用程序选择以打开 sh 文件的窗口之后(就像当您尝试在 Windows 中打开未知文件时,它询问您想使用哪个应用程序打开它)。我试过用 Git shell 打开它,但失败了......我必须做什么才能运行这个文件并继续 GameClosure 教程中的安装步骤?**
Here is a screenshot (alert in polish, but I think you all know this message).
这是一个屏幕截图(波兰语警报,但我想你们都知道这条消息)。
采纳答案by VonC
Try using the git-bash
available with msysgit, with the Git Bash.vbs
shortcut.
尝试使用git-bash
可用的msysgit和Git Bash.vbs
快捷方式。
Msysgit is also packagedwithin GitHub for Windows, even though the shell exposed is a Powershellone based on posh-git. That (powershell) would explain why *.sh
scripts cannot run on it.
Msysgit 也打包在GitHub for Windows 中,即使公开的shell 是基于posh-git的 Powershell。那(powershell)将解释为什么*.sh
脚本无法在其上运行。
The OP Szorstkimentions in the commentthat there actually is a setting in the GitHub for Windows app, that can set up Git Bash as the default command line tool.
该OP Szorstki提到的评论,有实际上是在GitHub上的Windows应用程序的设置,可以设置的Git bash作为默认的命令行工具。
回答by hd1
Try installing bash for Windowsand running the script ag again after executing bash from cmd.exe.
回答by Hannes Schneidermayer
Invokes the right shell, no unnecessary windows and invokes a bash script afterwards which will be hold.
调用正确的外壳,没有不必要的窗口,然后调用将被保留的 bash 脚本。
Create a Shortcutto
mintty.exe
on your desktop, for exampleEdit propertiesof the shortcut and change the target (keep the path):
C:\Program Files\Git\usr\bin\mintty.exe" -h always /bin/bash -l -e 'D:\folder\script.sh'
mintty.exe
例如,在桌面上创建一个快捷方式编辑快捷方式的属性并更改目标(保留路径):
C:\Program Files\Git\usr\bin\mintty.exe" -h always /bin/bash -l -e 'D:\folder\script.sh'