状況・エラー文
はじめて$ git commit
コマンドを使う際、コミットメッセージを登録するためのエディタが開かない。
ターミナルには以下のエラーメッセージ。
$ git commit
hint: Waiting for your editor to close the file... code --wait: code: command not found
error: There was a problem with the editor 'code --wait'.
Please supply the message using either -m or -F option.
原因・解決策
code: command not found
とあるので、vscodeのPathが原因と思われる。
vscodeを開いて設定を行う。
コマンドパレッド(Shift+Command+p)より、シェルコマンド PATH内にcodeコマンドをインストールします
を選択してインストールすると、解決した。
注
error: unable to start editor
となる場合は、configの設定が必要。
$ git config --global core.editor 'code --wait'
参考記事