3

I am trying to add a file to my github account using git bash. I have "commit", and I have entered the message required. But now, I am stuck (MINGW64). If I try :q, :quit, :quit!, nothing happens. If I try CTRL+C, I can enter :quit! but in this case my commit is aborted.

Do you have any idea?

Cyrus
  • 84,225
  • 14
  • 89
  • 153
Oolis
  • 146
  • 2
  • 2
  • 13
  • 1
    Ok, I have finally found a solution, and I post it (maybe it could help a newbie like me): esc then :wq. [link]http://stackoverflow.com/questions/5599122/problems-with-entering-git-commit-message-with-vim[/link] – Oolis Mar 19 '16 at 17:37

4 Answers4

12

It looks like your default editor is vi, so proper way to exit editor is: First exit INSERT MODE (press ESC), then type ":wq" and press enter.

To avoid this kind of situation, you can set your default editor, for example:

git config --global core.editor emacs

to set emacs editor. More about git configuration here

erhesto
  • 1,176
  • 7
  • 20
8

You have to do this:

  • write your message
  • ESC + : + w + q
CodeWizard
  • 128,036
  • 21
  • 144
  • 167
0

I think whenever you press Esc button Git-Bash get stuck. I don't know how to avoid that .

However Esc + : + w + q does seem to help a little bit, although most of the time I have to close the window !

0

My fix was to use \cmd\git.exe instead of mingw64 one. Orignally my mingw64\bin\git.exe stuck on commit or push as well, I aliased my git to the \cmd\git.exe and it fix it:

alias git="/c/Program\ Files/Git/cmd/git"

As a reference:

where git
C:\Program Files\Git\mingw64\bin\git.exe
C:\Program Files\Git\cmd\git.exe
2017561-1
  • 149
  • 6