Abd El Rahman Diaa
Abd El Rahman Diaa

Reputation: 59

How can I fix git commit error after closing the editor window?

I nearly started learning Git and GitHub very recently, and I need help with this:

https://i.sstatic.net/wIqw8.png

Whenever I close the text editor, it gets an error instead of adding the commit.

Upvotes: 5

Views: 935

Answers (2)

Git.Coach
Git.Coach

Reputation: 3092

Git requires you to add a message to your commit. When you type in git commit, it tries opening your configured editor to enter the commit message. Since your editor crashes, it cannot complete the commit. (See other answer on how to edit the preferences).

The quickest work around for you would be to directly provide a commit message for your commit by using the following command in your console:

git commit -m "Insert your commit message here"

This will skip the editor step by directly attaching the message.

Since you are new to Git and seem eager to learn, may I recommend the following article about writing good commit messages? Certainly helped myself a lot.

Excerpt from the article:

The seven rules of a great Git commit message Keep in mind: This has all been said before.

  1. Separate subject from body with a blank line
  2. Limit the subject line to 50 characters
  3. Capitalize the subject line
  4. Do not end the subject line with a period
  5. Use the imperative mood in the subject line
  6. Wrap the body at 72 characters
  7. Use the body to explain what and why vs. how

Upvotes: 0

VonC
VonC

Reputation: 1324258

Can you check how your editor is configured?

git config --global core.editor

Check this answer, and edit your config file with git config --global --edit, to add quotes:

editor = 'atom -w'

Check also atom/atom issue 16805:

Especially since Atom 1.24.0 it happens quite regularly that Atom freezes after starting.
The freeze is not complete but rather the menu partially works but it is not possible to edit any already open files or to open a new file.

When starting Atom with the --foreground option and it does not completely freeze the following message is shown:

Attempting to call a function in a renderer window that has been closed or released.
Function provided here: Object.<anonymous> (C:\Users\doberkofler.LBITS\AppData\Local\atom\app-1.24.0\resources\app.asar\node_modules\github\lib\worker.js:71:22   
Remote event names: destroyed, crashed

Upvotes: 3

Related Questions