Github Desktop for Mac doesn't run git hooks (pre-commit) #24072
-
I’ve set up a pre-commit hook that runs when I commit from the terminal, but doesn’t when I do it from Github Desktop for Mac. Any ideas why this isn’t working? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
👋 @matt-tyler-eb GitHub Desktop ships with an internal version of Git which we use for all actions inside the app. As such the environment within which your commit hooks execute will likely not exactly match that of your normal environment. Are you seeing any error messages? It’d also be helpful if you could take a look at the log to see if there is anything being shown there. To access the log files go to the file menu in GitHub Desktop and select |
Beta Was this translation helpful? Give feedback.
-
Not seeing any errors, it commits fine, it just doesn’t run my pre-commit hook. I’ve copied the logs below, it looks like the last one is the only one that is related, and it just indicates a successful commit as far as I can tell. How can I adjust my environment variables for GitHub Desktop to match the ones in my terminal?
|
Beta Was this translation helpful? Give feedback.
-
False alarm. I got an error when I ran my pre-commit script manually from the terminal saying |
Beta Was this translation helpful? Give feedback.
-
Glad to hear you were able to get things working! |
Beta Was this translation helpful? Give feedback.
False alarm. I got an error when I ran my pre-commit script manually from the terminal saying
dyld: Library not loaded: @rpath/lib_InternalSwiftSyntaxParser.dylib
and that pointed to my Xcode being configured incorrectly (I’m doing iOS development). Turned out since I had switched to a beta version of Xcode, it couldn’t find the Xcode command line tools that were being referenced within my pre-commit script and it was aborting when it hit that error. My problems were solved by pointing back to the official release of Xcode and pointing my xcode-select command line tools to that version. I did this with the following command:sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
…