I've try to follow this question and sulution Git Bash in emacs on Windows I have this function:
(prefer-coding-system 'utf-8)
(defun git-bash ()
(interactive)
(let ((explicit-shell-file-name "C:/Users/jankiewj/AppData/Local/Programs/Git/git-bash.exe")
(explicit-bash.exe-args '("--login" "-i")))
(call-interactively 'shell)))
but when I execute this function, git bash is created in new system window instead of Emacs window. So I don't even get the same error as OP.
I've also tried to run ansi-term but got error:
apply: Spawning child process: Invalid argument
How can I make git bash work inside Emacs window on MS Windows?