20
12

More than 1 year has passed since last update.

git commitしたら"Waiting for your editor to close the file..."と怒られた話

Last updated at Posted at 2021-03-12

こんにちは、JeffTechです。

エラー文

$ 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.

説明

私はGitのデフォルトエディタにVScodeを使用しているのですが、git commitをした後、COMMIT_EDITMSGファイルにてコミットメッセージを入力しました。
その後アクシデントが発生して、COMMIT_EDITMSGファイルを閉じないままvscodeを終了してしまったので、正しくコミットできていなかったので再度git commitしたら怒られてしまいました。
Waiting for your editor to close the file...エディタがファイルを閉じるのを待っています。。。 はい、ですよね笑

エラー解決法

最初にGitのデフォルトエディターをVScodeにしたと思いますが、全く同じことをしていきます。

まずはコマンドパレットを開きましょう。

  • Mac:「command + shift + p」
  • Windows:「Ctrl + shift + p」

開いたら、下記コマンドを実行してください。

> Shell Command: Install 'Code' command in path

次にターミナルから下記のコマンドを実行してください。

$ git config --global core.editor "code --wait"

最後に

これで私の場合は治りました。
こんなミスはめったにしないと思いますが、なっちゃった方はぜひ試してみてください。

少しでも役に立った!という時は、いいねをポチッとして
フォローしてくださると嬉しいです、、、笑

役に立たなかった時は、怒らないでコメント頂けますと幸いです笑

Twitterもやってますので、よかったら見てみてくださいね!
https://twitter.com/jefftechsaku

20
12
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
20
12