Uploaded image for project: 'Sourcetree For Mac'
  1. Sourcetree For Mac
  2. SRCTREE-7184

Commit hooks are skipped due to PATH issues

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: High High
    • None
    • 4.0
    • General, Git
    • Severity 2 - Major

      I've recently noticed that linting errors are not caught with our pre-commit hooks.

      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.
      Committing from the command line or IDE works ok (pre-commit runs).

      As the commit window closes quickly, I didn't even know what was the problem.
      Only after checking Preferences > Advanced > Always display full console output, I saw the following:

      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/vj/md8l7z_52v751h494yhrjr580000gn/T/SourceTreeTemp.B8F4vi

      Can't find yarn in PATH: /Applications/Sourcetree.app/Contents/Resources/git_local/libexec/git-core:/Applications/Sourcetree.app/Contents/Resources/bin:/Applications/Sourcetree.app/Contents/Resources/git_local/bin:/Applications/Sourcetree.app/Contents/Resources/git_local/gitflow:/Applications/Sourcetree.app/Contents/Resources/git_local/git-lfs:/usr/bin:/bin:/usr/sbin:/sbin

      Skipping pre-commit hook

      Completed successfully

      After spending several hours trying to fix it, without luck, I checked with other developers if they have the issue as well, and indeed, they had the same issue.

      Observed on different versions of SourceTree and macOS:

      SourceTree 3.x on macOS 10.15.1.
      SourceTree 4.0.1 on macOS 10.14.6.

      Also the PATH error can be other things like:

      Can't find node in PATH
      Can't find npx in PATH

      Basically the issue is that /usr/local/bin is not in the PATH list.

      This is really disheartening (making us doubt the reliability of SourceTree).
      Please give this issue priority.

      Thanks.

              43c951f935c6 Raman Sidarakin
              6666d464e45a alexilyaev
              Votes:
              78 Vote for this issue
              Watchers:
              71 Start watching this issue

                Created:
                Updated:
                Resolved: