git commit opens up two editor panes instead of one to enter message

When i run git commit it opens up 2 vi editor panes instead of one. The top pane is totally blank. The bottom pane is what I expect to see when running git commit. Every time I want to commit I have to close the top pane using :q before I can write my commit message.

Has anyone seen something like this before? What is the solution?

  • vim not working when calling git commit within cygwin
  • Where do piped files go on Windows?
  • Adding a git commit message using vi on OS X
  • How to fix:code indent should never use tabs in Vi
  • My command line locks up when making a commit with GIT
  • Getting “Vim: Caught deadly signal ILL” when trying to do basic git operations
  • Git command output shows special characters
  • 2 Solutions collect form web for “git commit opens up two editor panes instead of one to enter message”

    I don’t know why this worked, but I commented out a line in my .vimrc that changed the colorscheme.
    colorscheme solarized. Seems to have fixed the problem somehow. I guess the git commit wants to use a vi without customization and for some reason opens up a secondary pane when a different colorscheme is present.


    UPDATE:

    Fixed by putting the colorscheme solarized line in my .vimrc in an if block to see if it is called by git commit.

    Changed .vimrc:

    if $_ != 'git commit' 
    colorscheme solarized 
    endif
    

    I believe the issue is that Git doesn’t know what editor you want to use, so it runs vi by default, which launches Vim in compatibility mode.

    This could also happen with other applications, so you could set the VISUAL and/or EDITOR environment variables (or/as well as the git-specific GIT_EDITOR) in your ~/.bashrc to fix this:

    EDITOR=vim
    VISUAL=vim
    

    Alternatively, you can configure git itself to use vim:

    git config --global core.editor "vim"

    Git Baby is a git and github fan, let's start git clone.