6

I'm having some troubles with the command git commit. I did a git commit but unfortunately I've pressed Ctrl+Z instead of Ctrl+X to close, so now when I git commit again, it gives me this error:

error: editor died of signal 11
                           error: There was a problem with the editor 'editor'.   `Please, specific the message using option -m or -F. `

Actually I don't know how to fix this error. The operating system that I'm running is Ubuntu 15.10.

6 Answers 6

23
  1. Go to .git/ folder
  2. Delete the file .COMMIT_EDITMSG.swp
Sign up to request clarification or add additional context in comments.

4 Comments

Please add some explenation to your answer.
@AndréKool : I actually faced this problem. I noticed that .COMMIT_EDITMSG.swp was the file which was additional in the .git folder in which I was facing issue as compared to the module in which issue was not occurring. So after removing this file the problem was solved.
Just ran into this due to a terminal getting closed in the middle of a git merge, which left the swap file .COMMIT_EDITMSG.swp. Simply deleting it solves the problem.
This should be the approved answer! Worked like a charm.
3

Make sure you have done a git add <files> or git rm <files> then try using git commit -m "<commit message>" instead of opening an editor.

1 Comment

i didn't add any files, i've just removed one using git rm <filename> from my terminal
3

Most likely your EDITOR variable got deleted or reset. To avoid general problems now and in future, set this in your .zshrc or .bashrc

export EDITOR=$(which vim)

1 Comment

This is the answer
2

It seems like you're using the nano editor. When you hit Ctrl+Z you suspended the editor something that seems to happen.

Now git tells you that your editor is broken. Try to wake up nano by entering fg or kill the process with killall nano.

15 Comments

any nano process was found (i've used killall nano) and fg did nothing and the bash told me that fg is inexistent. So how can I recover it? i've already restarded the PC twice and still giving me that error using only git commit command instead of git commit -m <message>.
Ok that is strange a reboot should have recovered you from that. You do use nano right? I tried to replicate your problem and was not successful. Meaning: I did not have the problems you describe when suspending my nano session, I could even suspend two of them and bring them back to live using fg. Could you run man fg because your bash should have a fg built in.
yes I'm using nano. Actually terminal is telling me that there's no manual for fg, by the way nano process is active but when I use git commit it's still giving the same error, so I'm using -m option to commit correctly
So even after a reboot a nano process is running that you didn't start in this session? Strange. Do you know if your nano creates any swap files like vim?
I don't sorry. I'm new in using Ubuntu and git, and I don't know what vim is sorry... How can I check if my nano creates any swap files?
|
2

Try this one:- This is for skip staging and commit

git commit -a -m "message"

After remove or add any files, commit with this command:-

git commit -m "message"

Comments

2

Please set default editor for git using this command git config --global core.editor "vim"

Here I set Vim editor. It will fix you issue.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.