post checkout hook gives error when using desktop app, but fine in cmd line
See original GitHub issueDescription
I have a post-checkout hook.
When I use the command line the hook runs and the echo shows the message as expected
When I use the desktop I get an error message on checkout (see attached)
Version
GitHub Desktop version: 1.0.4
OS version: Microsoft Windows [Version 10.0.15063]
Steps to Reproduce
- get a copy of https://github.com/MrAntix/github-desktop-hooks
- install the hook (run install-hooks.bat)
- open in desktop
- checkout the other branch
Expected behavior: hook is run
Actual behavior: error - hook is not run
Reproduces how often: 100%
Logs
2017-10-16T11:30:56.993Z - info: [ui] launching: 1.0.4 (Windows 10.0.15063)
2017-10-16T11:31:00.758Z - error: [ui] git checkout --progress master --
exited with an unexpected code: 1.
Your branch is up-to-date with ‘origin/master’.
Switched to branch ‘master’ error: cannot spawn .git/hooks/post-checkout: No such file or directory
Additional Information
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Git checkout in post-receive hook: "Not a git repository '.'"
When I run sh . git/hooks/post-receive, everything works fine. But when I push from my PC I get this error: remote: fatal: Not...
Read more >Commit hooks are skipped due to PATH issues - Jira - Atlassian
At first I thought it's a problem with lint-staged or husky but eventually found that SourceTree on Mac just skips the commit hooks....
Read more >Git Hooks - Git SCM
The post-rewrite hook is run by commands that replace commits, such as git commit --amend and git rebase (though not by git filter-branch...
Read more >TortoiseSVN's Settings
On Windows Vista and later systems this controls whether dialogs use the Aero ... Subversion clients running on your PC, including the command...
Read more >Code with Git - Azure DevOps - Microsoft Learn
Open the Git command window (Git Bash on Git for Windows). Go to the folder where you want the code from the repo...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is an interesting side-effect of how we bundle Git in the app, and I needed to cast my mind back to this classic post.
Under the section “WHY WON’T GIT HOOKS WORK ON WINDOWS?”, we have this section:
What’s the fix?
As a workaround, these scripts can directly reference your Git installation, like so:
That will work for you, but it’s not an actual solution. Git for Windows doesn’t set any other environment variables than the path to
git.exe
, so it might have some magic internals we need to mimic when we invoke Git inside the app (our version of Git is limited in features, but it does havesh.exe
).We can’t support
bash.exe
scripts on Windows currently because it’s not part of the Git installation we embed, but/bin/sh
support should work once I get https://github.com/desktop/dugite/pull/141 merged and updated here.