'How do I commit with git when receiving error: Waiting for your editor to close the file...?

I am new to git and I was able to use it successfully with my first repository but I just added another and now I am unable to commit to either repository. When I make the commit I receive this message:

throg@throg-VirtualBox:~/repos/git_test$ git commit
hint: Waiting for your editor to close the file... error: cannot run code--wait: No such file or directory
error: unable to start editor 'code--wait'
Please supply the message using either -am or -F option.

I thought it might be problems with Visual Studio Code but I receive the same message when using that.

git


Solution 1:[1]

Run the command

git config --show-origin core.editor

It will print the config file path and the value of core.editor.

It seems you have set the wrong value code--wait. It should be code --wait. If it's the case, open the config file and edit the wrong value, save and quit.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ElpieKay