![]() ![]() I've tested #!/bin/sh is supported and worked with projects like husky that generate Git hooks to ensure they don't use #!/bin/bash unless absolutely necessary. This means you wont be able to execute any Git commands in the command prompt. We were unable to locate Git on your system. when I click it, I got a warning saying: Unable to locate Git. The embedded Git that we ship in GitHub Desktop does not contain a bash environment, so any scripts that rely on #!/bin/bash will not work. In the dropdown menu of Repository, you can see there is a button named Open in Git Bash (Ctrl + ). There's more to read about the various things to look for in that post, but that's the important takeaway. So sh.exe or bash.exe or whatever shell you desire need to be found on the PATH, and it's Git itself (not the OS) that is emulating the behaviour from other OSes. By default, what does it find when it looks for sh.exe at /bin/sh? Yup, nothing nothing at all. Git for Windows supports Bash commands and shell scripts via Cygwin. ![]() Windows is definitely not a Unix-like OS. If you want to work with Git locally, but do not want to use the command line, you can download and install the GitHub Desktop client. On Unix-like OS’s, the #! tells the program loader that this is a script to be interpreted, and /bin/sh is the path to the interpreter you want to use, sh in this case. This is a quote from this excellent post about how hooks work differently on Windows is recommended reading: I'm going to jump straight to here because there's some context to explain what's happening. pre-commit.bash doesn't work Windows as bash isn't found when run in the github app pre-commit thanks for the report!ĮXTRA: Try committing in a regular shell, this works per normal Non-Solutions Tried:Īlthough #!/bin/sh works on windows (as it uses bash) it's a non-solution for user's on other operating systems as #!/bin/sh does not in general point to #!/bin/bash.Ĭreating a trivial #!/bin/sh file that uses bash. The error mentioned in the top of the post occurs. I expected the git hook to work like it did in all three regular shells.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |