Unable to edit git commit message with newly installed git

Git allows the user to provied commit messages either via a command line argument or by opening a text editor with a commit message file that the user can freely edit. The obvious benefit of the latter is that one can use all the functionality of the chosen text editor and it is in general easier to write proper commit messages than when simply supplying the message via a command line argument. When freshly installing git on a linux system, the git command line client assumes that the vi text editor is installed and will try to use it to let users edit the commit messages. But if one does not have vi installed the git client is unable to find the vi executbale and thus will display an error message stating that git is unable to find the specified programm to open.
1 answer

Properly configure git before using it

In order to tell git which editor to use for editing the commit messages one simply needs to properly configure git. To achieve this one can either navigate into the local directory of a git repository and call git config core.editor EDITOR where EDITOR is the name of the executable of the editor one wants to use. This solution only configures the editor for the current repository. If one wants to use the same editor for all repositories one needs to use the --global flag.

Taggings: