为什么在使用 shelljs 克隆 git 存储库时会出现 NullReferenceException?

Why do I get a NullReferenceException when using shelljs to clone a git repo?

我正在尝试编写一个相当简单的 nodejs 程序,它需要克隆一个 git 存储库。

var shell = require('shelljs');
shell.exec('git clone http://mybitbuck.et/scm/myproject/myrepo.git');

报错如下,然后好像永远挂了不退出:

fatal: NullReferenceException encountered.
Object reference not set to an instance of an object.

没有额外的输出或堆栈跟踪,甚至没有行号。发生了什么,我怎样才能让它工作,或者至少获得更多关于正在发生的事情和原因的信息?

我知道我可以使用 nodegit 或类似的而不是使用 shell 但我想我会受益于理解这里发生的事情如何解决输出的情况好稀疏。

我解决了这个问题。与我运行的windows(2.19.1)的git版本有关,更新到最新版本消除了错误。

我最终找到了导致我遇到此错误的正确搜索词组合:https://github.com/git-for-windows/git/issues/1868