0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

sourcetreeでpre-commitに追加したときに、php: command not found が出たときの対応方法

Last updated at Posted at 2022-03-09

.git/hooks/pre-commitにスクリプトを入れ、SourceTreeでcommitすると
下記のエラーが出た

.git/hooks/pre-commit: line 25: php: command not found

対応方法

pre-commitファイルの二行目に、echo $SHELLをして、出てくる、下記を入れる

source ~/.zshrc

また、~/.zshrc の中には下記のようにPHPへのPATHを入れておく

export PATH=/opt/homebrew/opt/php@8.1/bin:$PATH

参考
https://www.underthecocotree.co.uk/blog/a-tale-of-sourcetree-and-git-hooks

別に
https://qiita.com/masato_makino/items/43787b6dfc49fe3b4d94
というやり方もあるみたい。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?