Sourcetree
Husky 5 doesn't work well with Sourcetree. When I commit Im getting this error
.husky/pre-commit: Line 4 yarn: command not found
Hi @codler, looks like a PATH issue, see https://typicode.github.io/husky/#/?id=command-not-found for a fix :)
@typicode I'm getting multiple errors in Sourcetree:
git --no-optional-locks -c color.branch=false -c color.diff=false -c color.status=false -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree commit -q -F /var/folders/jf/2wd2jwr96kq49m1ct0tq0jgc0000gn/T/SourceTreeTemp.Tkbiko
.husky/prepare-commit-msg: line 4: /dev/tty: Device not configured
.husky/commit-msg: line 4: npx: command not found
husky - commit-msg hook exited with code 127 (error)
Completed with errors, see above
Contents of my .huskyrc:
export NPM_DIR="$HOME/.npm"
[ -s "$NPM_DIR/npm.sh" ] && \. "$NPM_DIR/npm.sh"
I solved it on my environment with https://github.com/typicode/husky/issues/390#issuecomment-596969011.
$ echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.huskyrc
Probably this is better.
echo 'export PATH="$(dirname $(which npx)):$PATH"' >> ~/.huskyrc
ref. https://github.com/typicode/husky/issues/390#issuecomment-762213421
If it doesn't work, set it manually.
$ dirname $(which npx)
/Users/user-name/.asdf/shims
# Need adjust path
$ echo 'export PATH="~/.asdf/shims:$PATH"' >> ~/.huskyrc
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Husky 5 doesn't work well with Sourcetree. When I commit Im getting this error
.husky/pre-commit: Line 4 yarn: command not found
To perform a
echo "export PATH=":/usr/local/bin/:$PATH"" > ~/.huskyrc
this works for me:
move sourcetree from /Applications to ~/Applications
encoutering the same issue
if you are using nvm and homebrew, this should work in your .huskyrc
HOMEBREW_DIR=$(brew --prefix)
. "$HOMEBREW_DIR/opt/nvm/nvm.sh"
PATH=$NVM_BIN:$PATH
This worked for me:
Solution for Apple m1 Pro chip MacBook Pro - macOS 12.4 - using homebrew:
SourceTree -> Settings -> Git -> Use System Git -> "/opt/homebrew/bin/git" (NOT "/usr/*/git")
https://jira.atlassian.com/browse/SRCTREE-7184
Hi @codler, looks like a PATH issue, see https://typicode.github.io/husky/#/?id=command-not-found for a fix :)
有用,果然有问题还是得看官网
This worked for me:
Solution for Apple m1 Pro chip MacBook Pro - macOS 12.4 - using homebrew:
SourceTree -> Settings -> Git -> Use System Git -> "/opt/homebrew/bin/git" (NOT "/usr/*/git")
https://jira.atlassian.com/browse/SRCTREE-7184
这个可以搞定
This worked for me:
Solution for Apple m1 Pro chip MacBook Pro - macOS 12.4 - using homebrew:
SourceTree -> Settings -> Git -> Use System Git -> "/opt/homebrew/bin/git" (NOT "/usr/*/git")
https://jira.atlassian.com/browse/SRCTREE-7184
This one from @andrejstas worked for me too. You got to install git via brew though if you haven't installed, the path won't be there otherwise.
Husky 5 doesn't work well with Sourcetree. When I commit Im getting this error
.husky/pre-commit: Line 4 yarn: command not foundTo perform a
echo "export PATH=":/usr/local/bin/:$PATH"" > ~/.huskyrc
this works