Error running git submodule commands outside git-bash on Windows

782 views Asked by At

I'm working on a project with git submodules and sometimes need to run commands like git submodule init and git submodule update. I'm runnig Git for Windows 2.35.2.

The problem is that these very specific commands don't work on any environment except git-bash (other commands work well). When I run them on Windows CMD or even git-bash terminal inside VsCode i'm getting the error bellow.

$ git submodule update
Stack trace:
Frame        Function    Args
000FFFF9FB0  00180062CB7 (000FFFFA1B8, 00000000002, 00000000002, 000FFFFDE50)
...
000FFFFFFF0  001800477C4 (00000000000, 00000000000, 00000000000, 00000000000)
End of stack trace
/mingw64/libexec/git-core/git-sh-setup: line 46: /git-sh-i18n: No such file or directory

I've tried some obvious solutions like adding git paths or running CMD or VsCode on administration mode but nothing works. The thing is that the line of the script, mentioned on the error, should get the path of git-sh-i18n:

. "$(git --exec-path)/git-sh-i18n"

And when I run this line on CMD itself returns the right path:

git --exec-path
C:/Program Files/Git/mingw64/libexec/git-core

So, it should work, in the git-sh-setup script, but doesn't.

Has anyone had the same problem and have any tip?

1

There are 1 answers

0
vanderdill On

Apparently on newer versions of Git for Windows this problem doesn't happen anymore.