状況
git commit
した際に以下のようなエラーが発生しました。
ターミナル
$ git commit -m "hoge"
hint: Waiting for your editor to close the file... error: cannot run editor: No such file or directory
error: unable to start editor 'editor'
Please supply the message using either -m or -F option.
解消法
以下のコマンドを実行し、エディタを設定したところ解消しました。
ターミナル
$ git config --global core.editor "code --wait"
上記のコマンドはVSCodeに設定する際のものです。
他のエディタに設定する場合には"code --wait"
の箇所を変更する必要があります。
実行後の.gitconfig
の内容を確認すると以下のように追記されています。
ターミナル
$ cat ~/.gitconfig
<省略>
[core]
editor = code --wait