husky icon indicating copy to clipboard operation
husky copied to clipboard

Sourcetree

Open codler opened this issue 5 years ago • 13 comments

Husky 5 doesn't work well with Sourcetree. When I commit Im getting this error

.husky/pre-commit: Line 4 yarn: command not found

codler avatar Mar 19 '21 12:03 codler

Hi @codler, looks like a PATH issue, see https://typicode.github.io/husky/#/?id=command-not-found for a fix :)

typicode avatar Mar 21 '21 01:03 typicode

@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"

daviddelusenet avatar Apr 19 '21 14:04 daviddelusenet

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

k-utsumi avatar Jun 16 '21 09:06 k-utsumi

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.

stale[bot] avatar Aug 15 '21 10:08 stale[bot]

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

Lydanne avatar Nov 10 '21 08:11 Lydanne

this works for me:

move sourcetree from /Applications to ~/Applications

LuckyMona avatar Dec 02 '21 10:12 LuckyMona

encoutering the same issue

EmmanDizon avatar Apr 19 '22 06:04 EmmanDizon

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

brewster1134 avatar Jun 17 '22 16:06 brewster1134

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

andrejstas avatar Aug 30 '22 08:08 andrejstas

Hi @codler, looks like a PATH issue, see https://typicode.github.io/husky/#/?id=command-not-found for a fix :)

有用,果然有问题还是得看官网

viceroyliu avatar Sep 06 '22 09:09 viceroyliu

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

这个可以搞定

cat-kun avatar Nov 17 '22 03:11 cat-kun

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.

arthursady avatar Jan 20 '23 14:01 arthursady

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

elderdog avatar Sep 08 '23 08:09 elderdog