2

When saving a new commit message with git commit -a, or editing an existing message with git commit --amend, Vim seems to be failing to load the proper Git file, and is throwing "e32 No File Name" upon save.

Specifically with editing existing commits via git commit --amend, it is not loading the message, but rather displaying the "Vim - Vi Improved" screen. I can proceed to enter a message, and save, then when I check the git log I can see the original message, along with some unicode and erroneous characters:

commit 07aa5029e376

Original message

<U+0080>ý5:q
chriscaselas
  • 133
  • 1
  • 6
  • 1
    What file name does vim think it is working on in this case? What command is running (check `ps`?)? – Etan Reisner Jan 20 '15 at 20:00
  • @EtanReisner looks like it is writing to `project/.git/COMMIT_EDITMSG` does that seem right? – chriscaselas Jan 20 '15 at 21:52
  • Assuming the filename is `.git/COMMIT_EDITMSG` then that sounds right. What's the working directory? And that fails to load the current commit contents with `--amend`? – Etan Reisner Jan 20 '15 at 22:00
  • The directory is just in `~/code` so nothing out of the ordinary there. And yes that is correct, it fails to load the content of the commit. – chriscaselas Jan 20 '15 at 22:33
  • 1
    Can you try to do following: GIT_EDITOR=anyothereditor git commit --amend – manzur Jan 20 '15 at 23:19

1 Answers1

2

I had exactly the same problem and couldn't get it solved anywhere. However, after trying the answer of this post: How do I make Git use the editor of my choice for commits?, it just worked like intended with no file or utf-error anymore:

Set the GIT_EDITOR environment variable: export GIT_EDITOR=vim

Thats it. Hope this solves your problem as well.

Community
  • 1
  • 1
nrbrt
  • 162
  • 1
  • 10