error: There was a problem with the editor 'vi' when using it with git
As answered here:
https://stackoverflow.com/questions/22699614/git-commit-messages-lost-by-vi

The real solution is to 

git config --global core.editor vim -f


According to vim documentation - -f option should be used when Vim is executed by a program that will wait for the edit session to finish