致命:不是 git 存储库(或任何父目录):.git 当 "bundle install"

fatal: Not a git repository (or any of the parent directories): .git when "bundle install"

我有一个目录存在 Gemfile。

当我在目录中执行"bundle install"时,它显示警告信息

fatal: Not a git repository (or any of the parent directories): .git 

但如果我先在目录中执行 "git init",它不会显示此警告消息。

我知道这是关于 git 存储库的目录?但这是没有意义的。

为什么在目录下执行"bundle install"需要目录先成为git版本库?

旧版本的 Bundler 存在一个错误,可能与以下问题有关:https://github.com/carlhuda/bundler/issues/2039

绝对不是 git 或您的 git 存储库的问题。尝试更新捆绑器。最新稳定版本的捆绑器将解决此问题