GitHub Desktop seems to be using the wrong PATH variable

Hi, when trying to push a commit with GitHub desktop, I got the following error from husky:

.husky/pre-commit: line 4: yarn: command not found husky - pre-commit hook exited with code 127 (error) husky - command not found in PATH=/Applications/GitHub Desktop.app/Contents/Resources/app/git/libexec/git-core:/usr/bin:/bin:/usr/sbin:/sbin

However, the PATH returned in the error message is not the PATH I configured. Any idea on how to fix this?

Did you ever find a solution to this? Im also running into problems with the $PATH in GitHub Desktop not being aligned with what’s in my terminal and would like to get it picking up the correct values in GitHub Desktop.

Some users have had success resolving this by adding C:\Program Files\Git\bin to the system PATH. See this thread for more information.

I appreciate your response, thanks! But I’m on a Mac and git is definitely in my path.

However, I got a simple workaround which suggests that there’s something about the way GitHub Desktop starts up.

For example, after installation, if I started Desktop with the icon in the task bar then Desktop would not recognise any of my existing PATH details. But if I started Desktop from the cli using github then Desktop would get all the information and run my hooks just fine. Then once it’s started, I can just keep that instance in the task bar and starting up via the icons works after that.