2
1

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.

【Git】error: unable to start editor 'editor'解消法

Posted at

状況

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
2
1
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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?