How to run ./script.sh in windows Git shell?

2019-04-07 00:35发布

问题:

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).

I am doing installation steps from GameClosure and 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 file and proceed with installation steps from GameClosure tutorial?**

Here is a screenshot (alert in polish, but I think you all know this message).

回答1:

Try using the git-bash available with msysgit, with the Git Bash.vbs shortcut.

Msysgit is also packaged within GitHub for Windows, even though the shell exposed is a Powershell one based on posh-git. That (powershell) would explain why *.sh scripts cannot run on it.

The OP Szorstki mentions in the comment that there actually is a setting in the GitHub for Windows app, that can set up Git Bash as the default command line tool.



回答2:

Try installing bash for Windows and running the script ag again after executing bash from cmd.exe.



回答3:

Invokes the right shell, no unnecessary windows and invokes a bash script afterwards which will be hold.

  • Create a Shortcut to mintty.exe on your desktop, for example

  • Edit properties of 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'